Skip to main content

Packvium for Python

Deterministic 3D cartonization and rectangular bin packing. Pure Python, no runtime dependencies, exact integer geometry.

Version 0.1.0 — early release. The public API is not frozen; pin an exact version. Read docs/GUARANTEES.md before relying on a result.

pip install packvium

Quick start

from packvium import Container, Dimensions, Item, Packer, PackingConfig

result = Packer(PackingConfig.balanced()).pack(
    items=[Item.create("book", Dimensions.mm("210", "140", "30"), quantity=4)],
    containers=[Container.create("box", Dimensions.mm("400", "300", "250"))],
)

print(result.status)                      # feasible
for container in result.containers:
    for placement in container.placements:
        print(placement.item_id, placement.position, placement.orientation)

Fractional inches are exact, not approximated:

Dimensions.inches("12 3/8", "8 1/2", "3/4")

There is also a CLI that reads a JSON request on standard input:

echo '{"items":[{"id":"box","quantity":8,"dimensions":{"length":"50","width":"50","height":"50"}}],
       "containers":[{"id":"carton","inner_dimensions":{"length":"100","width":"100","height":"100"}}]}' \
  | python -m packvium

What it does

  • Exact arithmetic. Length is measured in ticks of 1/16000 mm and weight in 1/8 µg. No coordinate is ever a float, so no placement decision depends on rounding.
  • Real constraints. Weight and payload limits, permitted rotations, keep-upright, floor-only, non-stackable, top-load limits, minimum support ratio, tag incompatibility, clearance and rectangular obstacles.
  • A solver portfolio, not one algorithm. Regular-grid, layer, extreme-point, maximal-space and bounded exact search, selected by problem shape and profile.
  • Answers you can check. Every solution is re-validated by logic independent of the search. Unplaced items come back with a reason code, not silently missing.
  • Deterministic. The same input and seed produce the same result, always.
  • Multi-container and nested. Split across containers, or pack containers into containers.
  • Extensible. Register your own constraints, item orderings, candidate scorers, container selectors or complete solvers.

Documentation

Document Covers
docs/GUARANTEES.md What is promised and what is not. Start here.
docs/PUBLIC-API.md Inputs, outputs and status semantics.
docs/UNITS-AND-NUMERICS.md Units, accepted input forms, rounding policy.

Requirements

Python 3.10 or newer. No dependencies.

Other ports exist

The same request and result contract is implemented independently in PHP and Rust, and all three are held to producing identical placements on a shared fixture set. If your stack spans languages, you can compute a packing on any of them and get the same answer.

Contributing

See CONTRIBUTING.md. Security reports go through the process in SECURITY.md, not public issues.

License

MIT. See LICENSE.

Download files

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

Source Distribution

packvium-0.1.0.tar.gz (193.0 kB view details)

Uploaded Source

Built Distribution

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

packvium-0.1.0-py3-none-any.whl (108.9 kB view details)

Uploaded Python 3

File details

Details for the file packvium-0.1.0.tar.gz.

File metadata

  • Download URL: packvium-0.1.0.tar.gz
  • Upload date:
  • Size: 193.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for packvium-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fbf4c3a23acb9743ff20293cd3f5da46b427d39d1398e1e88a272bab5e1c0c14
MD5 497e90c6f91d519088792baf62aa97f7
BLAKE2b-256 f8b7895fbef585ea429dfa757bf64774bb41bbab55049a3e314a0251d3b8b1f9

See more details on using hashes here.

File details

Details for the file packvium-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: packvium-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 108.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for packvium-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d72a71e8cd315a94925eafb88d619efdda3151966341407e1359be9fd3cfb2d8
MD5 c83d1ccc9ad3575c618ba49cd5a371fa
BLAKE2b-256 42ac381ee4270d3a09482f3913f7fc593632739b4bcc707bc05da27b6b25b183

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

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