Skip to main content

pyboxbuilder

PyPI version Python versions License Documentation

Declarative 3D board game box and insert design library for PythonSCAD and pybosl2.

pyboxbuilder turns a high-level description of what goes inside a board game box — outer dimensions, non-printed boards, component inventory, sub-boxes, and compartments — into printable multi-material 3MF/STL geometry and a color-coded 3D packing guide PDF.

The library's governing principle is good defaults, not options: describe the storage you want and get printable files without tuning geometry you did not ask about.

Features

  • 22 Box Types — sliding lid, friction-fit cap, slipover, inset, snap-fit, threaded, bayonet, magnetic, print-in-place & filament hinges, clamshell, card shoe/library, dispenser, dice tray, sleeve drawer, modular interlock, and no-lid trays — each with matched body/lid mating geometry.
  • Smart Compartments & Finger Access — absolute or proportional layouts, circular/hex/SVG-silhouette wells, smooth curved finger scoops, rolled wall holes, and automatic neighbor clearance.
  • 3D Auto-Packing, Gap Absorption & Partial Boards — auto-packs sub-boxes inside the game box, avoids non-printed GameBoard regions (folded boards, player screens, playmats), absorbs small vertical gaps (<= 10 mm) into box height, and fills remaining voids with hollow spacer trays.
  • Component Inventories & Packing Guide PDFs — declare the game's piece inventory (project.define_inventory(...)) to verify 100% allocation across boxes, boards, and spacers, and generate a two-column color-coded packing guide PDF with a Box Summary, Master Component Checklist, and exploded 3D layer diagrams.
  • Thematic Lid Decoration — auto-sized plaques, finials, SVG icons, custom fonts, cut-through patterns (hex, grid, Voronoi, Ammann-Beenker, tilings), and multi-color accent layers.
  • Export & Caching — multi-color and single-color 3MF/STL export with content-based fingerprinting so unchanged parts are never rebuilt.

Installation

Requires Python 3.11+ and PythonSCAD (pythonscad>=1.2.0) for 3D geometry export (layout and packing logic run in pure Python).

# Core library
pip install pyboxbuilder

# With packing guide PDF support (fpdf2 + Pillow)
pip install "pyboxbuilder[pdf]"

# Everything (PythonSCAD + PDF + Shapely)
pip install "pyboxbuilder[all]"

Quick Example

from pyboxbuilder import BoxType, Color, LabelMode, LidBuilder, Project

project = Project("CardGame", game_box_size=(200, 150, 90))
actions = project.define_cards("Action Cards", count=120, size=(63.5, 88.0), thickness=0.6)
tokens = project.define_piece("Victory Tokens", count=40, diameter=20.0, thickness=2.0, bulk=True)

cards_box = project.box(
    BoxType.SLIDING,
    "Cards",
    size=(70, 100, None),  # height follows from 120 × 0.6 mm cards
    lid=LidBuilder(
        label_mode=LabelMode.FRAMED,
        frame_color=Color("gold"),
    ).titled("Cards"),
)
cards_box.store(actions)

tokens_box = project.box(BoxType.CAP, "Tokens", size=(80, 70, 30))
tokens_box.store(tokens)

project.verify_inventory(strict=True)
project.export("output/")

Browse 39 complete board game inserts in the example catalog and the Quickstart guide.

Documentation

Development

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install

# Quality checks (blocking in CI)
ruff check pyboxbuilder/ boxes/
mypy pyboxbuilder/
PYTHONPATH=".:tests" pytest tests/test_pyboxbuilder/ --base-only --ignore=tests/test_pyboxbuilder/render -k "not export" -n auto -q

License

Apache-2.0

Metadata

Release files for pyboxbuilder 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyboxbuilder 0.2.0
File Size Uploaded Provenance Actions
pyboxbuilder-0.2.0.tar.gz 404.4 kB With provenance Details for pyboxbuilder-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyboxbuilder 0.2.0
File Interpreter ABI Platform Actions
pyboxbuilder-0.2.0-py3-none-any.whl Python 3 none any Details for pyboxbuilder-0.2.0-py3-none-any.whl

Total release size: 835.1 kB

Release files / pyboxbuilder-0.2.0.tar.gz

Download URL pyboxbuilder-0.2.0.tar.gz
Size 404.4 kB
Tags Source
SHA-256 checksum
How to use checksums
76bf2181e40e5694ad9a44bc6aa0b6164f3e42e8d969ad0bd635cf8605c7844c
BLAKE2b-256 checksum
How to use checksums
7eff1bc66bf9039c72043b27f816dae88dd202bcbdbfe3e82b80e775ae2f2d8d
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 log

Release files / pyboxbuilder-0.2.0-py3-none-any.whl

Download URL pyboxbuilder-0.2.0-py3-none-any.whl
Size 430.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c091137f42aa60617a2e9d554455985e0aa482e828754dcd45d871ca1f92c264
BLAKE2b-256 checksum
How to use checksums
9a6b451d64a280e9a0fbfada5bf47cac511023c551fcf149a8cca07b097f6719
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 log

Security for pyboxbuilder 0.2.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.

Select from 2 files

Attestation for pyboxbuilder-0.2.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 log

A 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page