Skip to main content

pybosl2

Python ports of the BOSL2 OpenSCAD library, for use with PythonSCAD. The package is imported as pybosl2, with one module per wrapped/ported .scad file so each Python module can be read side by side with its OpenSCAD source.

Most modules (constants, math, vectors, paths, shapes2d, …) are standalone pure-Python ports that work in plain CPython. The modules that build native geometry (shapes3d, masking, and the .polygon()/.polyhedron() boundaries) import the pythonscad/openscad native modules at load time.

Reference

Installation

pip install pybosl2

This pulls in numpy. To build native geometry you also need PythonSCAD:

pip install pythonscad

Usage

Import by submodule (the square/circle/cube/text names intentionally shadow the plain OpenSCAD builtins with BOSL2's anchor/spin/orient-aware versions, so the package is deliberately not wildcard-re-exported):

from pybosl2 import cuboid

part = cuboid([20, 20, 10]).up(5)

Development & tests

The test-suite runs against a real, pip-installed pythonscad in a virtualenv:

python -m venv .venv          # create from outside the repo dir, or the local
                              # pybosl2/math.py etc. can shadow stdlib modules
source .venv/bin/activate
pip install -e '.[test]'      # installs pybosl2 + pytest + numpy + pythonscad
pytest

The [test] extra installs the pythonscad wheel, which provides the real pythonscad/openscad native modules the geometry code imports.

A small number of tests exercise the full PythonSCAD app rather than the pip wheel:

  • STL-render tests (tests/test_stl_render.py) drive the real PythonSCAD binary in a subprocess to export and measure meshes. They skip unless a binary is found (set PYTHONSCAD_BIN, or install the app to /Applications).
  • App-only native ops (e.g. roof()) skip when the pip wheel does not provide them.

Documentation

The API docs are built with Sphinx (autodoc + napoleon) straight from the module docstrings:

pip install -e '.[docs]'
make -C docs html      # renders into wiki/

On push to main, the docs GitHub Actions workflow builds and publishes them to GitHub Pages (enable Pages with Settings → Pages → Source: GitHub Actions). Examples in the docs embed interactive 3-D STL viewers; the renders are cached under docs/_generated/ and docs/_extra/_stl/ — commit those caches so the images appear on Pages, since CI has no PythonSCAD binary to render them.

License

BSD 2-Clause License — see LICENSE.

Metadata

Release files for pybosl2 0.7.4

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

Source distribution (sdist)

Source distribution for pybosl2 0.7.4
File Size Uploaded Provenance Actions
pybosl2-0.7.4.tar.gz 586.4 kB With provenance Details for pybosl2-0.7.4.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / pybosl2-0.7.4.tar.gz

Download URL pybosl2-0.7.4.tar.gz
Size 586.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3c6d1ad5e9e7c2128b2d32210aa3703dcb7b395f903cbf35fa11fe0260f313f0
BLAKE2b-256 checksum
How to use checksums
4a3936d4721764b37f9b6813a52c02ac7923a01fd6ffcd5644fc0b3fe5fb0653
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 8, 2026.

Transparency log

Release files / pybosl2-0.7.4-py3-none-any.whl

Download URL pybosl2-0.7.4-py3-none-any.whl
Size 502.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0da1be0af523d9f990e0703fb2e2d9d9b2523b67097e7be255d43e89b63fbfc5
BLAKE2b-256 checksum
How to use checksums
7daa569f4a49e6671ad5cd141fa486d30bc38ae824466b5a5f272fdee983d5ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 8, 2026.

Transparency log

Security for pybosl2 0.7.4

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 pybosl2-0.7.4.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 Aug 8, 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.

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