Skip to main content

compas_nest

Documentation: https://petrasvestartas.github.io/compas_nest/

2D irregular nesting for the COMPAS framework — Python bindings for the OpenNest C++ engines, built with nanobind.

Nest polylines with holes into sheets with holes, with live terminal progress and compas_viewer visualization.

compas_nest

Two engines

Class Engine Notes
opennest_collision physics / overlap-relaxation (np_nest) dependency-free; iteration-budget driven; nests parts into holes
opennest NFP + genetic algorithm (nfp_nest) bundled Clipper2; generation/fitness driven; carries part attributes through placement

Install

pip install compas_nest

From source (editable)

One-step (uv, macOS + Windows Git Bash + Linux): creates a local .venv, installs every dependency, and builds the package:

git clone --recurse-submodules https://github.com/petrasvestartas/compas_nest.git
cd compas_nest
bash bash/install.sh

After editing C++ sources, rebuild without recreating the env: bash bash/build.sh --test.

conda:

conda env create -f environment.yml
conda activate compas_nest
pip install --no-build-isolation -ve .

plain pip:

pip install nanobind "scikit-build-core[pyproject]"
pip install --no-build-isolation -ve .

The C++ engine sources live under external/nest/ (nest_physics_cpp/ + opennest_cpp/, the latter bundling Clipper2 and a minimal Boost subset). They are self-contained — no CGAL/Boost/Eigen download is needed.

Quick start

from compas.geometry import Polyline
from compas_nest import nest_geo, nest_sheets, opennest_collision

def rect(x0, y0, w, h):
    return Polyline([[x0, y0, 0], [x0+w, y0, 0], [x0+w, y0+h, 0], [x0, y0+h, 0], [x0, y0, 0]])

geo = nest_geo()
geo.add_part(rect(0, 0, 20, 10), copies=3)
geo.add_part(rect(0, 0, 15, 15), holes=[rect(5, 5, 5, 5)], copies=2)

sheets = nest_sheets()
sheets.add_sheet(rect(0, 0, 100, 100), holes=[rect(40, 40, 10, 10)])

result = opennest_collision(iterations=2000, num_rotations=64).solve(geo, sheets)

for group in result.placed_polylines():
    print("sheet", group["sheet_id"], "->", len(group["parts"]), "parts")

# serialize placed polylines (with holes) + transformations to COMPAS JSON
result.to_json("data/output/quickstart.json")

See the examples/ folder for the viewer workflows, and the documentation for examples, API reference and credits.

License & credits

MIT — see LICENSE. Attributions for the underlying work are in CREDITS.md.

Release files for compas-nest 0.1.1.post5

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

Source distribution (sdist)

Source distribution for compas-nest 0.1.1.post5
File Size Uploaded
compas_nest-0.1.1.post5.tar.gz 52.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for compas-nest 0.1.1.post5
File
compas_nest-0.1.1.post5-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
compas_nest-0.1.1.post5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details
compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details

Total release size: 56.3 MB

Release files / compas_nest-0.1.1.post5.tar.gz

Download URL compas_nest-0.1.1.post5.tar.gz
Size 52.4 MB
Tags Source
SHA-256 checksum
How to use checksums
4e15435876916761a5944ea6f8c7da5eeabeb16ec066f7ad0c731ee652315c5b
BLAKE2b-256 checksum
How to use checksums
da25da2f4269fc023bcfe2e65e0ffd5f2d297b6e09df0fd34c8ea21dd2e996b9
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 Sep 7, 2026.

Transparency log

Release files / compas_nest-0.1.1.post5-cp312-abi3-win_amd64.whl

Download URL compas_nest-0.1.1.post5-cp312-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b7b2c6e5ef52c9b4c72dceb411881198d4bf566e385e5e509c5e5d8f05328d37
BLAKE2b-256 checksum
How to use checksums
92b9fd9cc3509bf8ed8da2cc45aed75cc1701f608b7d1b8ae0124fc19327aca4
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 Sep 7, 2026.

Transparency log

Release files / compas_nest-0.1.1.post5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL compas_nest-0.1.1.post5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 992.1 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2c088b210ee17d907b7196c6e069bb201553dfafb67dc1587e740a110f76f531
BLAKE2b-256 checksum
How to use checksums
9e427566bcc3acf2cffc4e4b288317df81092fb67858b0642dbbc5ae7363a1d5
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 Sep 7, 2026.

Transparency log

Release files / compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_x86_64.whl

Download URL compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_x86_64.whl
Size 901.1 kB
Tags CPython 3.12 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
e5c59e50b604f9cfa919c3a087c3ceb2b3a8fa1c6514a90b3993d83268fe56b6
BLAKE2b-256 checksum
How to use checksums
4e59c94cd0206daafb9adcfbd75105d71501076b59ea4c1491ae86001f0a58e8
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 Sep 7, 2026.

Transparency log

Release files / compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_arm64.whl

Download URL compas_nest-0.1.1.post5-cp312-abi3-macosx_11_0_arm64.whl
Size 812.4 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fcd08e9c515cd4c3250c10feb75b64e180c41c2cd2d042379e53e1710eb7f9fc
BLAKE2b-256 checksum
How to use checksums
e81a6d81de00d75de4e723b8a71b20022710aa4c84082f99071344b4874901c6
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 Sep 7, 2026.

Transparency log
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