No description
  • Python 97.2%
  • JavaScript 1.1%
  • Jupyter Notebook 1.1%
  • CSS 0.3%
  • Nix 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
foosinn 6211824be6
Some checks failed
Docker / build (push) Has been cancelled
Build documentation and deploy to Pages / build (push) Has been cancelled
Build documentation and deploy to Pages / deploy (push) Has been cancelled
/ main (3.11) (push) Has been cancelled
/ main (3.15) (push) Has been cancelled
Dockerfile.web: use nginx alpine-slim
The default alpine image ships 50 MB of extra nginx modules (njs, acme,
geoip, ...). The web app needs only core features, so the image drops
from 90 MB to 39 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:38:24 +02:00
.claude Add the OpenSpec commands and skills for Claude Code 2026-10-19 12:18:58 +02:00
.github chore: python 3.15 was released. 2026-10-10 21:52:32 +02:00
boxes schema: keep defaults exactly as the CLI has them 2026-10-19 11:49:33 +02:00
documentation feat: move requirements.txt into pyproject 2026-08-29 11:19:00 +02:00
examples BasedBox: Fix bottom edge of back wall 2026-10-11 13:17:42 +02:00
inkex Build and ship inkscape inx files 2017-02-25 20:01:03 +01:00
locale Create pt_BR.po 2026-08-16 12:59:50 +02:00
openspec OpenSpec: archive add-picker-thumbnails and sync its specs 2026-10-19 13:03:30 +02:00
po Create pt_BR.po 2026-08-16 12:59:50 +02:00
scripts Dockerfile.web: use nginx alpine-slim 2026-10-19 13:38:24 +02:00
static RoundedTrapezoidBox: Add pictures and make stable 2026-10-15 08:17:34 +02:00
tests Add web/runtime.py, the Python side of the web worker 2026-10-19 11:50:49 +02:00
web web: load attrs in the worker at startup 2026-10-19 12:58:26 +02:00
.dockerignore Add a .dockerignore for builds from the local checkout 2026-10-19 12:37:14 +02:00
.gitattributes chore: add GitHub Linguist overrides in .gitattributes 2026-04-08 18:47:00 +02:00
.gitignore New lid styles: flatbrim, flatfang 2026-10-08 21:17:16 +02:00
.pre-commit-config.yaml feat: add typing to boxes 2026-10-06 19:11:54 +02:00
CODE_OF_CONDUCT.md Code of Conduct 2018-09-24 13:31:36 +02:00
CONTRIBUTING.rst feat: move requirements.txt into pyproject 2026-08-29 11:19:00 +02:00
docker-compose.yml Add Docker Compose file for easier local dev 2025-05-05 20:35:15 +02:00
examples.yml New lid styles: flatbrim, flatfang 2026-10-08 21:17:16 +02:00
flake.nix ignore lockfile; add imagemagick for thumbnail gen 2026-08-03 14:44:21 +02:00
LICENSE.txt Licence the code under GPLv3 2014-03-16 18:26:12 +01:00
MANIFEST.in Format code 2024-03-22 22:04:22 +01:00
pyproject.toml chore!: bump min python to 3.11 2026-10-04 21:44:16 +02:00
README.rst README: build and run the web app with podman 2026-10-19 12:45:25 +02:00
setup.py Add pyproject.toml and move meta data from setup.py 2024-08-06 22:58:24 +02:00

About Boxes.py
==============

+----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------------------------------------+
| .. image:: static/samples/NotesHolder.jpg    | .. image:: static/samples/OttoBody.jpg       | .. image:: static/samples/PaintStorage.jpg   | .. image:: static/samples/ShutterBox.jpg     | .. image:: static/samples/TwoPiece.jpg       |
+----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------------------------------------+

* Boxes.py is an online box generator

  * https://boxes.hackerspace-bamberg.de/

* Boxes.py is an Inkscape plug-in
* Boxes.py is library to write your own
* Boxes.py is free software licensed under GPL v3+
* Boxes.py is written in Python and runs with Python 3

Boxes.py comes with a growing set of ready-to-use, fully parametrized
generators. See https://florianfesti.github.io/boxes/html/generators.html for the full list.

+----------------------------------------------+----------------------------------------------+----------------------------------------------+
| .. image:: static/samples/AngledBox.jpg      | .. image:: static/samples/FlexBox2.jpg       | .. image:: static/samples/HingeBox.jpg       |
+----------------------------------------------+----------------------------------------------+----------------------------------------------+

Features
--------

Boxes.py generates SVG images that can be viewed directly in a web browser but also
postscript and - with pstoedit as external helper - other vector formats
including dxf, plt (aka hpgl) and gcode.

Of course the library and the generators allow selecting the "thickness"
of the material used and automatically adjusts lengths and width of
joining fingers and other elements.

The "burn" parameter compensates for the material removed by the laser. This
allows fine tuning the gaps between joins up to the point where plywood
can be press fitted even without any glue.

Finger Joints are the work horse of the library. They allow 90° edges
and T connections. Their size is scaled up with the material
"thickness" to maintain the same appearance. The library also allows
putting holes and slots for screws (bed bolts) into finger joints,
although this is currently not supported for the included generators.

Dovetail joints can be used to join pieces in the same plane.

Flex cuts allows bending and stretching the material in one direction. This
is used for rounded edges and living hinges.

+----------------------------------------------+----------------------------------------------+----------------------------------------------+
|   .. image:: static/samples/TypeTray.jpg     |     .. image:: static/samples/BinTray.jpg    | .. image:: static/samples/DisplayShelf.jpg   |
+----------------------------------------------+----------------------------------------------+----------------------------------------------+
| .. image:: static/samples/AgricolaInsert.jpg | .. image:: static/samples/HeartBox.jpg       | .. image:: static/samples/Atreus21.jpg       |
+----------------------------------------------+----------------------------------------------+----------------------------------------------+

Static web app
--------------

Boxes.py also runs fully in the browser with Pyodide. The web app needs no
backend, any static file server can host it. It shows the settings and a live
preview side by side.

Build it with the Python environment that has Boxes.py and its dependencies
installed. The first build downloads a pinned Pyodide release into
``build/cache/`` and checks its sha256, later builds work offline::

    python scripts/build_web

Try it locally (opening the files with ``file://`` does not work)::

    python -m http.server -d build/web

Then open http://localhost:8000/.

To build and serve it in a container instead, without a local Python
environment, run this in the repo root::

    podman build -f scripts/Dockerfile.web -t boxes-web .
    podman run --rm -p 8080:8080 boxes-web

Then open http://localhost:8080/. The image builds from the files in your
checkout, so it includes your local changes.

To publish it, copy ``build/web/`` to a static host. The host must serve
``.wasm`` as ``application/wasm`` and ``.mjs`` as ``application/javascript``,
and should compress ``.wasm``, ``.js`` and ``.json``. Pyodide is about 9.6 MB
uncompressed and 4 MB with gzip. ``scripts/nginx-web.conf`` is the nginx
config the container uses, take it as an example. Its ``types`` block
replaces the inherited MIME types, so keep it inside ``location /pyodide/``,
where all ``.mjs`` and ``.wasm`` files are.

The settings are part of the URL, for example ``#ABox?x=150``. The part after
``?`` uses the same format as the server, so ``/ABox?x=150`` on the server
becomes ``#ABox?x=150`` in the web app. Only changed values are kept.

The web app offers the formats svg, svg_Ponoko, ps and lbrn2. Formats that
need pstoedit or ps2pdf, like dxf, pdf, gcode and plt, are only available
with the command line and the server.

Documentation
-------------

Boxes.py comes with Sphinx based documentation for usage, installation
and development.

The rendered version can be viewed at <https://florianfesti.github.io/boxes/html/index.html>.