part-grimoire 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. part_grimoire-0.3.0/LICENSE +21 -0
  2. part_grimoire-0.3.0/PKG-INFO +209 -0
  3. part_grimoire-0.3.0/README.md +176 -0
  4. part_grimoire-0.3.0/pyproject.toml +51 -0
  5. part_grimoire-0.3.0/setup.cfg +4 -0
  6. part_grimoire-0.3.0/src/part_grimoire.egg-info/PKG-INFO +209 -0
  7. part_grimoire-0.3.0/src/part_grimoire.egg-info/SOURCES.txt +34 -0
  8. part_grimoire-0.3.0/src/part_grimoire.egg-info/dependency_links.txt +1 -0
  9. part_grimoire-0.3.0/src/part_grimoire.egg-info/entry_points.txt +2 -0
  10. part_grimoire-0.3.0/src/part_grimoire.egg-info/requires.txt +12 -0
  11. part_grimoire-0.3.0/src/part_grimoire.egg-info/top_level.txt +1 -0
  12. part_grimoire-0.3.0/src/partgrimoire/__init__.py +5 -0
  13. part_grimoire-0.3.0/src/partgrimoire/__main__.py +3 -0
  14. part_grimoire-0.3.0/src/partgrimoire/cast.py +409 -0
  15. part_grimoire-0.3.0/src/partgrimoire/cli.py +244 -0
  16. part_grimoire-0.3.0/src/partgrimoire/exports.py +108 -0
  17. part_grimoire-0.3.0/src/partgrimoire/familiar.py +209 -0
  18. part_grimoire-0.3.0/src/partgrimoire/glyphs.py +28 -0
  19. part_grimoire-0.3.0/src/partgrimoire/hardware.py +91 -0
  20. part_grimoire-0.3.0/src/partgrimoire/page.py +79 -0
  21. part_grimoire-0.3.0/src/partgrimoire/reagents.py +98 -0
  22. part_grimoire-0.3.0/src/partgrimoire/reference.py +131 -0
  23. part_grimoire-0.3.0/src/partgrimoire/ritual.py +156 -0
  24. part_grimoire-0.3.0/src/partgrimoire/rubric.py +500 -0
  25. part_grimoire-0.3.0/src/partgrimoire/scrying.py +303 -0
  26. part_grimoire-0.3.0/src/partgrimoire/visions.py +149 -0
  27. part_grimoire-0.3.0/tests/test_cast.py +163 -0
  28. part_grimoire-0.3.0/tests/test_docs.py +34 -0
  29. part_grimoire-0.3.0/tests/test_familiar.py +77 -0
  30. part_grimoire-0.3.0/tests/test_glyphs.py +42 -0
  31. part_grimoire-0.3.0/tests/test_hardware.py +33 -0
  32. part_grimoire-0.3.0/tests/test_reagents.py +47 -0
  33. part_grimoire-0.3.0/tests/test_ritual.py +77 -0
  34. part_grimoire-0.3.0/tests/test_rubric.py +124 -0
  35. part_grimoire-0.3.0/tests/test_scrying.py +93 -0
  36. part_grimoire-0.3.0/tests/test_visions.py +91 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Spikeon Studio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: part-grimoire
3
+ Version: 0.3.0
4
+ Summary: Cast a 3D-printable part from a config file and Python CAD code into STL, STEP, assemblies, exploded views, DXF outlines, Bambu Studio print files, a BOM, and docs.
5
+ Author: Spikeon Studio
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Spikeon-Studio/part-grimoire
8
+ Project-URL: Documentation, https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/index.md
9
+ Project-URL: Issues, https://github.com/Spikeon-Studio/part-grimoire/issues
10
+ Keywords: cad,3d-printing,step,stl,bom,exploded-view,bambu-studio,badcad
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Manufacturing
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: badcad-occt[occt,svg]<0.3,>=0.2
23
+ Requires-Dist: numpy>=2.0
24
+ Requires-Dist: pillow>=11
25
+ Requires-Dist: moderngl>=5.12
26
+ Requires-Dist: matplotlib>=3.9
27
+ Requires-Dist: ezdxf>=1.3
28
+ Provides-Extra: text
29
+ Requires-Dist: badcad-occt[text]<0.3,>=0.2; extra == "text"
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=8; extra == "test"
32
+ Dynamic: license-file
33
+
34
+ <p align="center"><img src="https://raw.githubusercontent.com/Spikeon-Studio/part-grimoire/main/docs/assets/banner.png" alt="part-grimoire: a terminal tool to materialize CAD from code grimoires" width="100%"></p>
35
+
36
+ # part-grimoire
37
+
38
+ [![Test](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml/badge.svg)](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml)
39
+ [![PyPI](https://img.shields.io/pypi/v/part-grimoire)](https://pypi.org/project/part-grimoire/)
40
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/Spikeon-Studio/part-grimoire/blob/main/LICENSE)
41
+
42
+ part-grimoire turns a part, written as a config file and Python CAD code, into a folder with everything to make it. It operates in the terminal, on your own computer, one stage after the other.
43
+
44
+ You write a **chapter**: a **rubric** (`rubric.toml`) and an **incantation** (a [badcad](https://github.com/spikeon/badcad) Python file). Then you **cast** it. The cast writes a **page** for each aspect (variant) of the part. It seals each page into a **spell** (a zip file). A page has:
45
+
46
+ - an STL and a STEP file for each **talisman** (printed piece)
47
+ - a **glyph** (a DXF outline) of each talisman
48
+ - the **bound form** (the assembled part) as STL, 3MF, and STEP, with one named, coloured solid for each item
49
+ - the **sigil** (thumbnail) and an **illumination** (picture) of each talisman
50
+ - an exploded view of each **rite** (assembly step), and **the unveiling** (an exploded view of all the rites)
51
+ - the **manifestation**: a Bambu Studio print project and a sliced plate, with the print time and the filament weight
52
+ - the **reagents** (the bill of materials) as CSV, JSON, and Markdown
53
+ - the page text (a README) and the **colophon** (the build record)
54
+
55
+ The [glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) gives the plain meaning of each term. part-grimoire is a terminal version of the model build pipeline of ExoWorks.
56
+
57
+ ## Install
58
+
59
+ ### With pip
60
+
61
+ ```bash
62
+ pip install part-grimoire
63
+ ```
64
+
65
+ pip installs part-grimoire and its Python packages. It does not install the system libraries or the familiar (Bambu Studio). Without the familiar, use `cast --no-manifest`. `part-grimoire augur` shows what is missing.
66
+
67
+ ### With the installer
68
+
69
+ The installer installs everything, the familiar included:
70
+
71
+ ```bash
72
+ git clone https://github.com/Spikeon-Studio/part-grimoire.git
73
+ ```
74
+
75
+ ```bash
76
+ cd part-grimoire && ./install.sh
77
+ ```
78
+
79
+ The installer installs:
80
+
81
+ 1. The system packages: Python, git, the OpenGL and EGL libraries, Xvfb, and the cairo headers. It uses `apt`, `dnf`, `pacman`, or `zypper`, and `sudo` prompts you for your password.
82
+ 2. A Python environment in `~/.local/share/part-grimoire/venv` with badcad, build123d, manifold3d, OCP, numpy, scipy, shapely, Pillow, moderngl, matplotlib, ezdxf, and pycairo.
83
+ 3. The `part-grimoire` command in `~/.local/bin`.
84
+ 4. The familiar (Bambu Studio): the Docker image `ghcr.io/spikeon/bambu-studio-mcp:latest` if Docker is on the computer, else `com.bambulab.BambuStudio` from Flathub.
85
+
86
+ Then it starts `part-grimoire augur`, which checks each dependency.
87
+
88
+ | Installer option | Effect |
89
+ | --- | --- |
90
+ | `--familiar docker` | Use the Docker image of Bambu Studio. Install Docker if it is missing. |
91
+ | `--familiar flatpak` | Use Bambu Studio from Flathub. Install Flatpak if it is missing. |
92
+ | `--familiar skip` | Do not install Bambu Studio. The casts make no manifestation. |
93
+ | `--no-system` | Do not install system packages. |
94
+ | `--dev` | Make an editable install with the test tools. |
95
+ | `--uninstall` | Remove the environment, the command link, and the settings. |
96
+
97
+ ## Quick start
98
+
99
+ ```bash
100
+ part-grimoire inscribe my-box
101
+ ```
102
+
103
+ ```bash
104
+ part-grimoire cast my-box
105
+ ```
106
+
107
+ The page is in `my-box/pages/my-box/`, and the spell is `my-box/pages/my-box.spell.zip`. To find and store a good camera for each picture:
108
+
109
+ ```bash
110
+ part-grimoire divine my-box
111
+ ```
112
+
113
+ ## Commands
114
+
115
+ | Command | Effect |
116
+ | --- | --- |
117
+ | `part-grimoire cast [chapter]` | Cast the spell: make the page and the spell of each aspect. |
118
+ | `part-grimoire divine [chapter]` | Find the cameras of the views and store them in `visions.toml`. `--jev` lets Jev find. |
119
+ | `part-grimoire scry [chapter]` | Read the chapter. Show the talismans, the rites, and the reagent cost. Write nothing. |
120
+ | `part-grimoire inscribe <folder>` | Make a chapter with an example part. |
121
+ | `part-grimoire augur` | Check that the computer has all the dependencies. |
122
+ | `part-grimoire lore <machine\|process\|filament>` | List the Bambu Studio profiles. |
123
+
124
+ The [command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) gives all the options.
125
+
126
+ ## A chapter
127
+
128
+ `rubric.toml`:
129
+
130
+ ```toml
131
+ [chapter]
132
+ name = "cable-clip"
133
+ title = "Cable Clip"
134
+ version = "2.1"
135
+ incantation = "clip.py"
136
+
137
+ [aspects]
138
+ cable = [4, 6, 8]
139
+
140
+ [tinctures]
141
+ latch = "#d2691e"
142
+
143
+ [reagents."M3x12 screw"]
144
+ kind = "screw"
145
+ d = 3
146
+ length = 12
147
+ price = 7.49
148
+ pack = 100
149
+
150
+ [rites.latch]
151
+ title = "Attach the latch"
152
+ text = "Put the latch on the base. Install the screw."
153
+ camera = [-35, 15]
154
+
155
+ [manifestation]
156
+ printer = "Bambu Lab P1S 0.4 nozzle"
157
+ ```
158
+
159
+ `clip.py`:
160
+
161
+ ```python
162
+ from partgrimoire import Ritual
163
+
164
+
165
+ def talismans(cable):
166
+ return {"base": base(), "latch": latch(cable)}
167
+
168
+
169
+ def ritual(talismans, cable):
170
+ r = Ritual()
171
+ r.rite("latch")
172
+ r.talisman("base", talismans["base"])
173
+ r.talisman("latch", talismans["latch"], rite="latch", explode=0.8)
174
+ r.reagent("M3x12 screw", at=(-9, 0, 6 + cable + 4.8), axis=(0, 0, 1), rite="latch", explode=2.0)
175
+ return r
176
+ ```
177
+
178
+ The full example is in [`examples/cable-clip`](https://github.com/Spikeon-Studio/part-grimoire/tree/main/examples/cable-clip).
179
+
180
+ ## Cameras
181
+
182
+ Each picture can store its own camera (`camera`, `zoom`, `center`) in the rubric. `part-grimoire divine` finds cameras that show the items best, and stores them in `visions.toml`. With `--jev`, the Jev decision model finds from the best cameras. Jev is optional, and a stored camera always wins. See [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md).
183
+
184
+ ## Documentation
185
+
186
+ | Page | Contents |
187
+ | --- | --- |
188
+ | [Get started](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/getting-started.md) | Install, inscribe, scry, cast, and divine |
189
+ | [The incantation](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/incantation.md) | `talismans()`, `ritual()`, and the `Ritual` methods |
190
+ | [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md) | The pictures, the stored cameras, `divine`, and Jev |
191
+ | [Reagents](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/reagents.md) | Hardware items, prices, and the reagent list |
192
+ | [The familiar](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/familiar.md) | Bambu Studio: backends, profiles, and print settings |
193
+ | [The page](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/page.md) | The outputs, the glyphs, the colophon, and the seal |
194
+ | [Rubric reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/rubric.md) | Each table and key, with its type and default |
195
+ | [Command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) | All commands and options |
196
+ | [Glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) | The grimoire terms |
197
+ | [Troubleshooting](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/troubleshooting.md) | Errors and their causes |
198
+
199
+ ## Tests
200
+
201
+ ```bash
202
+ ./install.sh --dev
203
+ ```
204
+
205
+ ```bash
206
+ ~/.local/share/part-grimoire/venv/bin/python -m pytest
207
+ ```
208
+
209
+ The tests use only the fixture chapter in `tests/fixtures`. They do not start the familiar or Jev. GitHub Actions does the tests on Python 3.12 and 3.14 for each push to `main` and each pull request.
@@ -0,0 +1,176 @@
1
+ <p align="center"><img src="https://raw.githubusercontent.com/Spikeon-Studio/part-grimoire/main/docs/assets/banner.png" alt="part-grimoire: a terminal tool to materialize CAD from code grimoires" width="100%"></p>
2
+
3
+ # part-grimoire
4
+
5
+ [![Test](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml/badge.svg)](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml)
6
+ [![PyPI](https://img.shields.io/pypi/v/part-grimoire)](https://pypi.org/project/part-grimoire/)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/Spikeon-Studio/part-grimoire/blob/main/LICENSE)
8
+
9
+ part-grimoire turns a part, written as a config file and Python CAD code, into a folder with everything to make it. It operates in the terminal, on your own computer, one stage after the other.
10
+
11
+ You write a **chapter**: a **rubric** (`rubric.toml`) and an **incantation** (a [badcad](https://github.com/spikeon/badcad) Python file). Then you **cast** it. The cast writes a **page** for each aspect (variant) of the part. It seals each page into a **spell** (a zip file). A page has:
12
+
13
+ - an STL and a STEP file for each **talisman** (printed piece)
14
+ - a **glyph** (a DXF outline) of each talisman
15
+ - the **bound form** (the assembled part) as STL, 3MF, and STEP, with one named, coloured solid for each item
16
+ - the **sigil** (thumbnail) and an **illumination** (picture) of each talisman
17
+ - an exploded view of each **rite** (assembly step), and **the unveiling** (an exploded view of all the rites)
18
+ - the **manifestation**: a Bambu Studio print project and a sliced plate, with the print time and the filament weight
19
+ - the **reagents** (the bill of materials) as CSV, JSON, and Markdown
20
+ - the page text (a README) and the **colophon** (the build record)
21
+
22
+ The [glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) gives the plain meaning of each term. part-grimoire is a terminal version of the model build pipeline of ExoWorks.
23
+
24
+ ## Install
25
+
26
+ ### With pip
27
+
28
+ ```bash
29
+ pip install part-grimoire
30
+ ```
31
+
32
+ pip installs part-grimoire and its Python packages. It does not install the system libraries or the familiar (Bambu Studio). Without the familiar, use `cast --no-manifest`. `part-grimoire augur` shows what is missing.
33
+
34
+ ### With the installer
35
+
36
+ The installer installs everything, the familiar included:
37
+
38
+ ```bash
39
+ git clone https://github.com/Spikeon-Studio/part-grimoire.git
40
+ ```
41
+
42
+ ```bash
43
+ cd part-grimoire && ./install.sh
44
+ ```
45
+
46
+ The installer installs:
47
+
48
+ 1. The system packages: Python, git, the OpenGL and EGL libraries, Xvfb, and the cairo headers. It uses `apt`, `dnf`, `pacman`, or `zypper`, and `sudo` prompts you for your password.
49
+ 2. A Python environment in `~/.local/share/part-grimoire/venv` with badcad, build123d, manifold3d, OCP, numpy, scipy, shapely, Pillow, moderngl, matplotlib, ezdxf, and pycairo.
50
+ 3. The `part-grimoire` command in `~/.local/bin`.
51
+ 4. The familiar (Bambu Studio): the Docker image `ghcr.io/spikeon/bambu-studio-mcp:latest` if Docker is on the computer, else `com.bambulab.BambuStudio` from Flathub.
52
+
53
+ Then it starts `part-grimoire augur`, which checks each dependency.
54
+
55
+ | Installer option | Effect |
56
+ | --- | --- |
57
+ | `--familiar docker` | Use the Docker image of Bambu Studio. Install Docker if it is missing. |
58
+ | `--familiar flatpak` | Use Bambu Studio from Flathub. Install Flatpak if it is missing. |
59
+ | `--familiar skip` | Do not install Bambu Studio. The casts make no manifestation. |
60
+ | `--no-system` | Do not install system packages. |
61
+ | `--dev` | Make an editable install with the test tools. |
62
+ | `--uninstall` | Remove the environment, the command link, and the settings. |
63
+
64
+ ## Quick start
65
+
66
+ ```bash
67
+ part-grimoire inscribe my-box
68
+ ```
69
+
70
+ ```bash
71
+ part-grimoire cast my-box
72
+ ```
73
+
74
+ The page is in `my-box/pages/my-box/`, and the spell is `my-box/pages/my-box.spell.zip`. To find and store a good camera for each picture:
75
+
76
+ ```bash
77
+ part-grimoire divine my-box
78
+ ```
79
+
80
+ ## Commands
81
+
82
+ | Command | Effect |
83
+ | --- | --- |
84
+ | `part-grimoire cast [chapter]` | Cast the spell: make the page and the spell of each aspect. |
85
+ | `part-grimoire divine [chapter]` | Find the cameras of the views and store them in `visions.toml`. `--jev` lets Jev find. |
86
+ | `part-grimoire scry [chapter]` | Read the chapter. Show the talismans, the rites, and the reagent cost. Write nothing. |
87
+ | `part-grimoire inscribe <folder>` | Make a chapter with an example part. |
88
+ | `part-grimoire augur` | Check that the computer has all the dependencies. |
89
+ | `part-grimoire lore <machine\|process\|filament>` | List the Bambu Studio profiles. |
90
+
91
+ The [command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) gives all the options.
92
+
93
+ ## A chapter
94
+
95
+ `rubric.toml`:
96
+
97
+ ```toml
98
+ [chapter]
99
+ name = "cable-clip"
100
+ title = "Cable Clip"
101
+ version = "2.1"
102
+ incantation = "clip.py"
103
+
104
+ [aspects]
105
+ cable = [4, 6, 8]
106
+
107
+ [tinctures]
108
+ latch = "#d2691e"
109
+
110
+ [reagents."M3x12 screw"]
111
+ kind = "screw"
112
+ d = 3
113
+ length = 12
114
+ price = 7.49
115
+ pack = 100
116
+
117
+ [rites.latch]
118
+ title = "Attach the latch"
119
+ text = "Put the latch on the base. Install the screw."
120
+ camera = [-35, 15]
121
+
122
+ [manifestation]
123
+ printer = "Bambu Lab P1S 0.4 nozzle"
124
+ ```
125
+
126
+ `clip.py`:
127
+
128
+ ```python
129
+ from partgrimoire import Ritual
130
+
131
+
132
+ def talismans(cable):
133
+ return {"base": base(), "latch": latch(cable)}
134
+
135
+
136
+ def ritual(talismans, cable):
137
+ r = Ritual()
138
+ r.rite("latch")
139
+ r.talisman("base", talismans["base"])
140
+ r.talisman("latch", talismans["latch"], rite="latch", explode=0.8)
141
+ r.reagent("M3x12 screw", at=(-9, 0, 6 + cable + 4.8), axis=(0, 0, 1), rite="latch", explode=2.0)
142
+ return r
143
+ ```
144
+
145
+ The full example is in [`examples/cable-clip`](https://github.com/Spikeon-Studio/part-grimoire/tree/main/examples/cable-clip).
146
+
147
+ ## Cameras
148
+
149
+ Each picture can store its own camera (`camera`, `zoom`, `center`) in the rubric. `part-grimoire divine` finds cameras that show the items best, and stores them in `visions.toml`. With `--jev`, the Jev decision model finds from the best cameras. Jev is optional, and a stored camera always wins. See [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md).
150
+
151
+ ## Documentation
152
+
153
+ | Page | Contents |
154
+ | --- | --- |
155
+ | [Get started](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/getting-started.md) | Install, inscribe, scry, cast, and divine |
156
+ | [The incantation](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/incantation.md) | `talismans()`, `ritual()`, and the `Ritual` methods |
157
+ | [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md) | The pictures, the stored cameras, `divine`, and Jev |
158
+ | [Reagents](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/reagents.md) | Hardware items, prices, and the reagent list |
159
+ | [The familiar](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/familiar.md) | Bambu Studio: backends, profiles, and print settings |
160
+ | [The page](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/page.md) | The outputs, the glyphs, the colophon, and the seal |
161
+ | [Rubric reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/rubric.md) | Each table and key, with its type and default |
162
+ | [Command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) | All commands and options |
163
+ | [Glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) | The grimoire terms |
164
+ | [Troubleshooting](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/troubleshooting.md) | Errors and their causes |
165
+
166
+ ## Tests
167
+
168
+ ```bash
169
+ ./install.sh --dev
170
+ ```
171
+
172
+ ```bash
173
+ ~/.local/share/part-grimoire/venv/bin/python -m pytest
174
+ ```
175
+
176
+ The tests use only the fixture chapter in `tests/fixtures`. They do not start the familiar or Jev. GitHub Actions does the tests on Python 3.12 and 3.14 for each push to `main` and each pull request.
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "part-grimoire"
7
+ version = "0.3.0"
8
+ description = "Cast a 3D-printable part from a config file and Python CAD code into STL, STEP, assemblies, exploded views, DXF outlines, Bambu Studio print files, a BOM, and docs."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Spikeon Studio" }]
13
+ requires-python = ">=3.11"
14
+ keywords = ["cad", "3d-printing", "step", "stl", "bom", "exploded-view", "bambu-studio", "badcad"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Manufacturing",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Topic :: Multimedia :: Graphics :: 3D Modeling",
24
+ ]
25
+ dependencies = [
26
+ "badcad-occt[occt,svg]>=0.2,<0.3",
27
+ "numpy>=2.0",
28
+ "pillow>=11",
29
+ "moderngl>=5.12",
30
+ "matplotlib>=3.9",
31
+ "ezdxf>=1.3",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ text = ["badcad-occt[text]>=0.2,<0.3"]
36
+ test = ["pytest>=8"]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/Spikeon-Studio/part-grimoire"
40
+ Documentation = "https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/index.md"
41
+ Issues = "https://github.com/Spikeon-Studio/part-grimoire/issues"
42
+
43
+ [project.scripts]
44
+ part-grimoire = "partgrimoire.cli:main"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["src"]
48
+
49
+ [tool.pytest.ini_options]
50
+ testpaths = ["tests"]
51
+ pythonpath = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: part-grimoire
3
+ Version: 0.3.0
4
+ Summary: Cast a 3D-printable part from a config file and Python CAD code into STL, STEP, assemblies, exploded views, DXF outlines, Bambu Studio print files, a BOM, and docs.
5
+ Author: Spikeon Studio
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Spikeon-Studio/part-grimoire
8
+ Project-URL: Documentation, https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/index.md
9
+ Project-URL: Issues, https://github.com/Spikeon-Studio/part-grimoire/issues
10
+ Keywords: cad,3d-printing,step,stl,bom,exploded-view,bambu-studio,badcad
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Manufacturing
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: badcad-occt[occt,svg]<0.3,>=0.2
23
+ Requires-Dist: numpy>=2.0
24
+ Requires-Dist: pillow>=11
25
+ Requires-Dist: moderngl>=5.12
26
+ Requires-Dist: matplotlib>=3.9
27
+ Requires-Dist: ezdxf>=1.3
28
+ Provides-Extra: text
29
+ Requires-Dist: badcad-occt[text]<0.3,>=0.2; extra == "text"
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=8; extra == "test"
32
+ Dynamic: license-file
33
+
34
+ <p align="center"><img src="https://raw.githubusercontent.com/Spikeon-Studio/part-grimoire/main/docs/assets/banner.png" alt="part-grimoire: a terminal tool to materialize CAD from code grimoires" width="100%"></p>
35
+
36
+ # part-grimoire
37
+
38
+ [![Test](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml/badge.svg)](https://github.com/Spikeon-Studio/part-grimoire/actions/workflows/test.yml)
39
+ [![PyPI](https://img.shields.io/pypi/v/part-grimoire)](https://pypi.org/project/part-grimoire/)
40
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/Spikeon-Studio/part-grimoire/blob/main/LICENSE)
41
+
42
+ part-grimoire turns a part, written as a config file and Python CAD code, into a folder with everything to make it. It operates in the terminal, on your own computer, one stage after the other.
43
+
44
+ You write a **chapter**: a **rubric** (`rubric.toml`) and an **incantation** (a [badcad](https://github.com/spikeon/badcad) Python file). Then you **cast** it. The cast writes a **page** for each aspect (variant) of the part. It seals each page into a **spell** (a zip file). A page has:
45
+
46
+ - an STL and a STEP file for each **talisman** (printed piece)
47
+ - a **glyph** (a DXF outline) of each talisman
48
+ - the **bound form** (the assembled part) as STL, 3MF, and STEP, with one named, coloured solid for each item
49
+ - the **sigil** (thumbnail) and an **illumination** (picture) of each talisman
50
+ - an exploded view of each **rite** (assembly step), and **the unveiling** (an exploded view of all the rites)
51
+ - the **manifestation**: a Bambu Studio print project and a sliced plate, with the print time and the filament weight
52
+ - the **reagents** (the bill of materials) as CSV, JSON, and Markdown
53
+ - the page text (a README) and the **colophon** (the build record)
54
+
55
+ The [glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) gives the plain meaning of each term. part-grimoire is a terminal version of the model build pipeline of ExoWorks.
56
+
57
+ ## Install
58
+
59
+ ### With pip
60
+
61
+ ```bash
62
+ pip install part-grimoire
63
+ ```
64
+
65
+ pip installs part-grimoire and its Python packages. It does not install the system libraries or the familiar (Bambu Studio). Without the familiar, use `cast --no-manifest`. `part-grimoire augur` shows what is missing.
66
+
67
+ ### With the installer
68
+
69
+ The installer installs everything, the familiar included:
70
+
71
+ ```bash
72
+ git clone https://github.com/Spikeon-Studio/part-grimoire.git
73
+ ```
74
+
75
+ ```bash
76
+ cd part-grimoire && ./install.sh
77
+ ```
78
+
79
+ The installer installs:
80
+
81
+ 1. The system packages: Python, git, the OpenGL and EGL libraries, Xvfb, and the cairo headers. It uses `apt`, `dnf`, `pacman`, or `zypper`, and `sudo` prompts you for your password.
82
+ 2. A Python environment in `~/.local/share/part-grimoire/venv` with badcad, build123d, manifold3d, OCP, numpy, scipy, shapely, Pillow, moderngl, matplotlib, ezdxf, and pycairo.
83
+ 3. The `part-grimoire` command in `~/.local/bin`.
84
+ 4. The familiar (Bambu Studio): the Docker image `ghcr.io/spikeon/bambu-studio-mcp:latest` if Docker is on the computer, else `com.bambulab.BambuStudio` from Flathub.
85
+
86
+ Then it starts `part-grimoire augur`, which checks each dependency.
87
+
88
+ | Installer option | Effect |
89
+ | --- | --- |
90
+ | `--familiar docker` | Use the Docker image of Bambu Studio. Install Docker if it is missing. |
91
+ | `--familiar flatpak` | Use Bambu Studio from Flathub. Install Flatpak if it is missing. |
92
+ | `--familiar skip` | Do not install Bambu Studio. The casts make no manifestation. |
93
+ | `--no-system` | Do not install system packages. |
94
+ | `--dev` | Make an editable install with the test tools. |
95
+ | `--uninstall` | Remove the environment, the command link, and the settings. |
96
+
97
+ ## Quick start
98
+
99
+ ```bash
100
+ part-grimoire inscribe my-box
101
+ ```
102
+
103
+ ```bash
104
+ part-grimoire cast my-box
105
+ ```
106
+
107
+ The page is in `my-box/pages/my-box/`, and the spell is `my-box/pages/my-box.spell.zip`. To find and store a good camera for each picture:
108
+
109
+ ```bash
110
+ part-grimoire divine my-box
111
+ ```
112
+
113
+ ## Commands
114
+
115
+ | Command | Effect |
116
+ | --- | --- |
117
+ | `part-grimoire cast [chapter]` | Cast the spell: make the page and the spell of each aspect. |
118
+ | `part-grimoire divine [chapter]` | Find the cameras of the views and store them in `visions.toml`. `--jev` lets Jev find. |
119
+ | `part-grimoire scry [chapter]` | Read the chapter. Show the talismans, the rites, and the reagent cost. Write nothing. |
120
+ | `part-grimoire inscribe <folder>` | Make a chapter with an example part. |
121
+ | `part-grimoire augur` | Check that the computer has all the dependencies. |
122
+ | `part-grimoire lore <machine\|process\|filament>` | List the Bambu Studio profiles. |
123
+
124
+ The [command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) gives all the options.
125
+
126
+ ## A chapter
127
+
128
+ `rubric.toml`:
129
+
130
+ ```toml
131
+ [chapter]
132
+ name = "cable-clip"
133
+ title = "Cable Clip"
134
+ version = "2.1"
135
+ incantation = "clip.py"
136
+
137
+ [aspects]
138
+ cable = [4, 6, 8]
139
+
140
+ [tinctures]
141
+ latch = "#d2691e"
142
+
143
+ [reagents."M3x12 screw"]
144
+ kind = "screw"
145
+ d = 3
146
+ length = 12
147
+ price = 7.49
148
+ pack = 100
149
+
150
+ [rites.latch]
151
+ title = "Attach the latch"
152
+ text = "Put the latch on the base. Install the screw."
153
+ camera = [-35, 15]
154
+
155
+ [manifestation]
156
+ printer = "Bambu Lab P1S 0.4 nozzle"
157
+ ```
158
+
159
+ `clip.py`:
160
+
161
+ ```python
162
+ from partgrimoire import Ritual
163
+
164
+
165
+ def talismans(cable):
166
+ return {"base": base(), "latch": latch(cable)}
167
+
168
+
169
+ def ritual(talismans, cable):
170
+ r = Ritual()
171
+ r.rite("latch")
172
+ r.talisman("base", talismans["base"])
173
+ r.talisman("latch", talismans["latch"], rite="latch", explode=0.8)
174
+ r.reagent("M3x12 screw", at=(-9, 0, 6 + cable + 4.8), axis=(0, 0, 1), rite="latch", explode=2.0)
175
+ return r
176
+ ```
177
+
178
+ The full example is in [`examples/cable-clip`](https://github.com/Spikeon-Studio/part-grimoire/tree/main/examples/cable-clip).
179
+
180
+ ## Cameras
181
+
182
+ Each picture can store its own camera (`camera`, `zoom`, `center`) in the rubric. `part-grimoire divine` finds cameras that show the items best, and stores them in `visions.toml`. With `--jev`, the Jev decision model finds from the best cameras. Jev is optional, and a stored camera always wins. See [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md).
183
+
184
+ ## Documentation
185
+
186
+ | Page | Contents |
187
+ | --- | --- |
188
+ | [Get started](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/getting-started.md) | Install, inscribe, scry, cast, and divine |
189
+ | [The incantation](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/incantation.md) | `talismans()`, `ritual()`, and the `Ritual` methods |
190
+ | [Scrying and cameras](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/scrying.md) | The pictures, the stored cameras, `divine`, and Jev |
191
+ | [Reagents](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/reagents.md) | Hardware items, prices, and the reagent list |
192
+ | [The familiar](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/familiar.md) | Bambu Studio: backends, profiles, and print settings |
193
+ | [The page](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/page.md) | The outputs, the glyphs, the colophon, and the seal |
194
+ | [Rubric reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/rubric.md) | Each table and key, with its type and default |
195
+ | [Command reference](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/cli.md) | All commands and options |
196
+ | [Glossary](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/glossary.md) | The grimoire terms |
197
+ | [Troubleshooting](https://github.com/Spikeon-Studio/part-grimoire/blob/main/docs/troubleshooting.md) | Errors and their causes |
198
+
199
+ ## Tests
200
+
201
+ ```bash
202
+ ./install.sh --dev
203
+ ```
204
+
205
+ ```bash
206
+ ~/.local/share/part-grimoire/venv/bin/python -m pytest
207
+ ```
208
+
209
+ The tests use only the fixture chapter in `tests/fixtures`. They do not start the familiar or Jev. GitHub Actions does the tests on Python 3.12 and 3.14 for each push to `main` and each pull request.