Packvium for Python
Framework-independent Python library for deterministic packing of rigid cuboids into rectangular containers.
Supports Python 3.9–3.14. Python 3.9 is retained as a legacy-compatibility runtime; production deployments should use a version still supported upstream.
pip install packvium
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"))],
)
Quotes, policy and catalog versions
packvium.commerce prices a shipment, decides an eligibility question, and reports which
catalog version a reference resolves to. Three deterministic functions over one JSON
document you supply — no clock, no network, no hidden state:
from packvium.commerce import quote
document = {"tariffs": [{
"carrier_id": "acme", "service_id": "ground",
"versions": [{
"effective_at": 0,
"dimensional_weight_divisor": 5000, # mm^3 per gram of dimensional weight
"cost_per_dimensional_kg_minor": {"zone-a": 450}, # cents per billed kilogram
"minimum_charge_minor": 900,
"fuel_surcharge_permille": 120, # 120 = 12.0%
"accessorials": [{"accessorial_id": "liftgate", "flat_charge_minor": 250}],
}],
}]}
result = quote(document, {
"carrier_id": "acme", "service_id": "ground",
"tariff_version": 1, # or "as_of": <instant>, never both
"zone": "zone-a", "actual_weight_g": 1200, "volume_mm3": 6_000_000,
"requested_accessorials": ["liftgate"],
})
result["quote"]["total_minor"] # 1258, itemised alongside in the same object
evaluate_policy(document, request) returns the decision and the rule id and version
that made it. catalog_version_info(document, request) reports which version a pin or an
as_of resolves to, what it contains, and whether it was a rollback.
A runnable walk-through of all three, including both kinds of failure, is in examples/commerce.py.
Two kinds of failure, and they are not interchangeable:
- a malformed document or request is your bug and is raised/thrown;
- a request the model simply cannot answer — no tariff effective at that instant, no
rate for that zone — is a successful call returning
"status": "rejected"with a code from a closed set and structured fields naming what was missing.
The full contract — document format, every result shape, all ten rejection codes,
complexity and limitations — is docs/COMMERCE-API.md in the suite repository.
Highlights:
- exact integer geometry for millimetres and fractional inches;
- immutable requests and results;
- Grid, Layer, Extreme Point, Maximal Space and bounded exact-small solvers;
- weight, rotation, clearance, support, top-load, floor-only, compatibility and obstacle constraints;
- deterministic multi-start search and top-K alternatives;
- independent post-solve validation;
- JSON/CLI API and nested packing;
- stable extension protocols for custom constraints, item ordering and solvers.
The complete architecture, algorithms, complexity, conformance and publishing documentation is intentionally stored in the parent packvium-suite/docs directory, outside this package repository.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file packvium-0.1.1.tar.gz.
File metadata
- Download URL: packvium-0.1.1.tar.gz
- Upload date:
- Size: 243.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e5a5088ac689e7be89dbe71e7b14e8c14efb43fb84e22bbbe97ae917311aef
|
|
| MD5 |
aaaae5d78d2e414492a3cdd1f2883cc1
|
|
| BLAKE2b-256 |
b29d2fedbc9164b5b0ff4b3124933d16c1b882d3fac3718a6added6dc5e0d0d8
|
File details
Details for the file packvium-0.1.1-py3-none-any.whl.
File metadata
- Download URL: packvium-0.1.1-py3-none-any.whl
- Upload date:
- Size: 139.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dabd5fadfdad822c83b5fb60af12756abb497e83d3f1215d1c89efa80ecd1b2d
|
|
| MD5 |
10d5239e3cc8706cdc6f71fa4bdcb78a
|
|
| BLAKE2b-256 |
0baa668de2529ea82c606636effd4fa21d26f1dfff1bbebc0b03c691c07be261
|