pyboxbuilder
Board game box and insert design library for PythonSCAD.
pyboxbuilder turns a declarative description of what goes in a game box — the
outer size, the boxes, and the compartments inside each — into the CSG geometry
PythonSCAD renders and the 3MF files a slicer prints. Every solid and shape is
built on pybosl2.
The library's governing principle is good defaults, not options: in the ordinary case you describe the storage and get printable files, without tuning geometry you did not ask about.
Features
- Box types — sliding lid, cap (friction-fit), hinged, filament-hinge, magnetic, and no-lid trays, each with its correct mating geometry between body and lid.
- Compartments — sized absolutely or as ratios of the interior, laid out automatically in rows or at explicit coordinates, including non-rectangular (hex, circular, silhouette) shapes.
- Finger cuts — scoops into compartment walls or floors, and rolled holes in the exterior walls, so every piece is easy to lift out.
- Nested inserts — sub-boxes auto-packed into the game box, auto-sized to fill their rows, with leftover gaps absorbed or turned into hollow spacer trays.
- Lid decoration — auto-sized labels (framed, frameless, diagonal), cut-through patterns (hex, grid, Voronoi, tessellation), and three accent colours per lid.
- Export — per-piece multi-colour and single-colour 3MF, a 3D packing-guide PDF, and content-based caching so unchanged files are never rewritten.
Quick example
from pyboxbuilder import BoxType, Color, LabelMode, LidBuilder, Project
project = Project("CardGame", game_box_size=(200, 150, 90))
cards = project.box(
BoxType.SLIDING, "Cards",
size=(70, 100, None), # height follows from the cards
lid=LidBuilder(label_mode=LabelMode.FRAMED,
frame_color=Color("gold")).titled("Cards"),
)
cards.cards("Deck", count=120, size=(63.5, 88.0))
project.export("output/")
More runnable examples live in the Sphinx documentation
(docs/quickstart.rst) and under boxes/.
Install
Requires Python 3.12+ and PythonSCAD for geometry; the layout and packing logic run without it.
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
Documentation
The API reference is generated from the docstrings with Sphinx and the
sphinx-immaterial theme (left-hand site nav, right-hand "on this page" method
links), and every pythonscad-example block renders its example box through the
real PythonSCAD binary.
- Stable docs — https://pinkfish.github.io/pythonscad_boxes/stable/
- Dev docs — https://pinkfish.github.io/pythonscad_boxes/dev/
Checks
PYBOXBUILDER_EXPORT_FN=12 python3 -m pytest tests/test_pyboxbuilder/ -q
ruff check pyboxbuilder/ boxes/
mypy pyboxbuilder/
All three are blocking in CI. Ruff also runs locally as a pre-commit hook:
pre-commit install
License
Metadata
Release files for pyboxbuilder 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyboxbuilder-0.1.0.tar.gz | 399.9 kB | With provenance | Details for pyboxbuilder-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyboxbuilder-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyboxbuilder-0.1.0-py3-none-any.whl |
Total release size: 826.7 kB
Release files / pyboxbuilder-0.1.0.tar.gz
| Download URL | pyboxbuilder-0.1.0.tar.gz |
|---|---|
| Size | 399.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77a62bdc052f48bf7292505b38915e3d282ccfaab39dbc74bff8290ed11efcc5
|
|
BLAKE2b-256 checksum How to use checksums |
ed68028e9e9169b28dc2b2c5ff2b27baebcfa78d27cbea48df8bcb027efd8752
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / pyboxbuilder-0.1.0-py3-none-any.whl
| Download URL | pyboxbuilder-0.1.0-py3-none-any.whl |
|---|---|
| Size | 426.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1efc5909ac2eb3949d41f88c7ea22af4cf777933030915ad4d6ebdf29e04966e
|
|
BLAKE2b-256 checksum How to use checksums |
50a25deef16697604e7744309e1b14ae7732b2fd86043b79754a7d998ce6cd9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for pyboxbuilder 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyboxbuilder-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.