Skip to main content

Python CAD Tools

Python CAD Tools is an installable, typed Python package for defining shared CAD/BIM models and producing STEP, IFC4, GLB, conceptual SVG/DXF/PDF drawings, quantity schedules, validation reports, and manifests in a headless workflow.

The canonical project identities are:

Licensed under AGPL-3.0-only. Published on PyPI.

Install

pip install "python-cad-tools[all]"

Capability-based extras (cad, bim, mesh, drawings, engineering, visualization) install a subset of the curated, version-tested toolchain. See docs/toolchain.md for the supported-library table, the dependency license policy, and the compatibility verification matrix.

Install for development

Python 3.12 or 3.13 is required.

python3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'

An ordinary non-editable installation exposes the same package and command:

python3 -m pip install ./dist/python_cad_tools-*.whl
python-cad --version

Build locally

Building the complete distribution requires Python 3.12 or 3.13 and Node.js 22.15.0. From a fresh checkout, create and activate the Python environment before building the viewer. Activation is important because the viewer staging script reads the installed python-cad-tools version from that environment.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'

cd viewer
npm ci
npm test
npm run build
cd ..

python -m build --wheel --sdist --outdir dist .
python -m twine check dist/*

The viewer build compiles the private TypeScript source and stages its verified, model-free static shell under src/python_cad_tools/_viewer_static/. The final wheel and source archive are written to dist/. To inspect the viewer while developing its source, run npm run preview from viewer/ after npm run build and open the local URL printed by Vite.

To build and serve an actual CAD project with the locally installed editable package, change to that project's directory and run:

python-cad build
python-cad serve

Create a new project

python-cad init --destination my-cad-project
cd my-cad-project
python -m venv .venv
.venv/bin/pip install python-cad-tools
.venv/bin/python-cad build

The scaffold includes model.py, config.py, pyproject.toml, README.md, .gitignore, and generated/.gitkeep. Edit config.py for dimensions and materials; edit model.py for design elements.

Command line

python-cad --version reports the version from installed distribution metadata. Project operations use explicit subcommands:

python-cad init --destination my-project
python-cad validate --project-root .
python-cad build --project-root . --format step --format quantities
python-cad verify --project-root .
python-cad prepare-site --project-root . --destination _site --base-path /
python-cad serve --project-root . --port 0
python-cad clean --project-root .

The project root defaults to the current directory. Builds use project locks, unique staging, final-byte verification, and recoverable journaled promotion. validate writes no artifacts; verify independently reproduces the manifest inventory, sizes, SHA-256 values, schemas, and parser checks. prepare-site deploys the packaged model-free viewer without Node, and serve binds to loopback by default. See docs/viewer-delivery.md for ownership, caching, offline, and deployment details.

Python API

Public symbols are imported from their documented modules:

from pathlib import Path

from python_cad_tools.build import BuildOptions, build_project

result = build_project(BuildOptions(project_root=Path(".")))

Project code should preserve stable semantic IDs, keep geometry parametric, and create geometry and metadata together. Generated artifacts are outputs, never design inputs.

Project-owned drawing annotations use the typed, renderer-independent boundary documented in docs/drawing-extensions.md. One annotation set is validated and rendered consistently to SVG, DXF, and PDF before artifact hashes are recorded.

Python CAD Tools is a curated engineering platform with a two-tier authoring contract: verified authoring through the neutral model (Tier 1), and supported-but-unverified direct use of a pinned library such as ifcopenshell or trimesh (Tier 2). See docs/two-tier-contract.md, docs/neutral-model.md, and docs/toolchain.md.

Verification

.venv/bin/ruff check .
.venv/bin/mypy
.venv/bin/pytest -q
.venv/bin/pytest tests/integration -q
.venv/bin/pytest tests/packaging -q
.venv/bin/pytest tests/typing -q
.venv/bin/python -m build --wheel --sdist --outdir dist .
.venv/bin/python -m twine check dist/*

The default pytest command runs the fast unit suite. Integration, packaging, and external typing suites are explicit release gates. Packaging tests inspect wheel and sdist inventories, install the wheel non-editably into an isolated environment outside the checkout, prove the import resolves from that environment's site-packages, and run python-cad --version.

Viewer TypeScript is maintainer source in viewer/; only its verified, model-free production shell is included in the wheel. See docs/build-semantics.md, docs/manifests.md, docs/project-configuration.md, docs/public-api.md, and docs/viewer-delivery.md for detailed reference.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_cad_tools-0.1.10.tar.gz (981.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_cad_tools-0.1.10-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file python_cad_tools-0.1.10.tar.gz.

File metadata

  • Download URL: python_cad_tools-0.1.10.tar.gz
  • Upload date:
  • Size: 981.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_cad_tools-0.1.10.tar.gz
Algorithm Hash digest
SHA256 bc9ca38801eac890c91bd029e31187bc5fb23b81fed876ca976d3a8252aa0acd
MD5 3d53e32b739894ee4bc81043c903c59c
BLAKE2b-256 4e4954a15f05e0025ce3a024d2995c0f65ebe963744ee9f5a4ec3f6706e33040

See more details on using hashes here.

File details

Details for the file python_cad_tools-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for python_cad_tools-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 84dc3e74679d7b309bbe9cb8707a0299e3c5402a6ac6b97c2c3063271aae1f2a
MD5 993e412051080b9b78082730a620e3a6
BLAKE2b-256 5982d8b3d71fc1d6f057120b0f34c33b6ee7822f0bac86e4edbcddf5b9c389b4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.13

2 files

0.1.11

2 files

This release

0.1.10 This release

2 files

0.1.9

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

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