Metadata-Version: 2.4
Name: packvium-native
Version: 1.11.0
Summary: Packvium backend selector: the native engine when a wheel is available, pure Python otherwise.
Author: Packvium contributors
License-Expression: MIT
Project-URL: Homepage, https://packvium.com
Project-URL: Documentation, https://packvium.com/docs
Project-URL: Source, https://github.com/packvium/packvium-python-adapter
Project-URL: Issues, https://github.com/packvium/packvium-python-adapter/issues
Keywords: 3d-bin-packing,bin-packing,3d-packing,cartonization,container-loading,pallet-packing,truck-loading,packing-algorithm,logistics,deterministic,box-packing,load-planning
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: packvium; python_version >= "3.10" and extra == "test"
Provides-Extra: native
Requires-Dist: packvium-native-rust==1.11.0; extra == "native"
Dynamic: license-file

# packvium-native

Optional native backend selector for [Packvium](https://pypi.org/project/packvium/).
It uses the compiled Rust wheel when available and otherwise delegates to the pure
Python package.

Full documentation, the constraint reference and benchmarks live at
[packvium.com](https://packvium.com).

## Install

```bash
pip install 'packvium-native[native]' packvium
```

The `native` extra installs the platform wheel. To use only the fallback, install
`packvium-native` together with `packvium`.

`packvium-native` is not on PyPI yet. Until the native wheels ship, install it from source:

```bash
pip install git+https://github.com/packvium/packvium-python-adapter packvium
```

## Quick start

```python
from packvium_native import backend, pack

result = pack({
    "items": [{
        "id": "book", "quantity": 4,
        "dimensions": {"length": "210", "width": "140", "height": "30"},
    }],
    "containers": [{
        "id": "carton",
        "inner_dimensions": {"length": "400", "width": "300", "height": "250"},
    }],
})

print(backend())          # "rust" or "python"
print(result["status"])  # "feasible"
```

The adapter does not replace the `packvium` import. It is useful when an application
wants one stable call site with a native fast path and a pure-Python fallback.

`pack_json` takes and returns the same JSON string every other Packvium binding speaks —
useful when the request is already serialized, or being forwarded as-is:

```python
from packvium_native import pack_json

response = pack_json('{"items":[...],"containers":[...]}')
```

## Examples

Runnable, in [`examples/`](examples). Each one is a single file you can read top to bottom
and execute without a project around it.

| File | What it shows |
| --- | --- |
| [`basic.py`](examples/basic.py) | Pack through the adapter and report which backend answered. |
| [`shapes.py`](examples/shapes.py) | Items that are not their box: complementary wedges sharing one crate as `convex_hull`, two copies of one wedge that need the signed rotation `-L-W+H`, a cushion that compresses under load until the crush limit refuses it, and a gusseted bag that holds a layer more than a flat one — the same numbers whichever backend answered. |

```bash
python3 examples/basic.py
```

## Platforms

Native wheels support Linux x86_64/aarch64, macOS Apple Silicon/Intel and Windows. The
wheel uses Python's stable ABI, so one wheel supports Python 3.9 and later on its
platform.

## The Packvium family

One request and result contract, implemented independently in four engines (Rust,
Python, PHP, JavaScript) and checked against each other on a shared fixture set. Python and
PHP are held to byte-identical canonical results; Rust and the JavaScript fallback are held
to independent validity and a per-fixture objective floor.
Pick the package for your stack; mixing them in one system is safe.

Documentation, the constraint reference and the benchmarks are at
[packvium.com](https://packvium.com).

| Package | Install | Source |
| --- | --- | --- |
| Python — [`packvium`](https://pypi.org/project/packvium/) | `pip install packvium` | [packvium-python](https://github.com/packvium/packvium-python) |
| PHP — [`packvium/packvium`](https://packagist.org/packages/packvium/packvium) | `composer require packvium/packvium` | [packvium-php](https://github.com/packvium/packvium-php) |
| Rust — [`packvium`](https://crates.io/crates/packvium) | `packvium = "1.11"` | [packvium-rust](https://github.com/packvium/packvium-rust) |
| Node.js — [`@packvium/engine`](https://www.npmjs.com/package/@packvium/engine) | `npm install @packvium/engine` | [packvium-node](https://github.com/packvium/packvium-node) |
| Browser / WebAssembly — [`@packvium/browser`](https://www.npmjs.com/package/@packvium/browser) | `npm install @packvium/browser` | [packvium-wasm](https://github.com/packvium/packvium-wasm) |
| PHP FFI bridge — [`packvium/native-bridge`](https://packagist.org/packages/packvium/native-bridge) | `composer require packvium/native-bridge` | [packvium-php-bridge](https://github.com/packvium/packvium-php-bridge) |
| Python native selector — `packvium-native` | from source until the native wheels ship | [packvium-python-adapter](https://github.com/packvium/packvium-python-adapter) |

## Citation

If Packvium supports your research, cite it as software. GitHub's **Cite this repository**
button reads [`CITATION.cff`](https://github.com/packvium/packvium-python-adapter/blob/main/CITATION.cff), and
[`codemeta.json`](https://github.com/packvium/packvium-python-adapter/blob/main/codemeta.json) carries the same record in
CodeMeta form.

```bibtex
@software{packvium_python_adapter,
  author  = {{Packvium contributors}},
  title   = {Packvium native backend selector for Python},
  version = {1.11.0},
  license = {MIT},
  url     = {https://packvium.com}
}
```

## License

MIT. See [LICENSE](LICENSE).
