The `binpacking` library provides heuristic algorithms for distributing weighted items into bins. It supports scenarios with either a fixed number of bins or a fixed volume per bin, accepting data as lists, dictionaries, tuples, or CSV files. The current version is 2.0.1, and it has an active release cadence, with major updates and bug fixes released periodically.
pip install binpackingVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the two primary bin packing functions: `to_constant_volume` for packing into bins with a maximum capacity, and `to_multiple_bins` for packing into a predefined number of bins. Items are provided as a dictionary where keys are item identifiers and values are their weights or sizes.
Upgrade your Python environment to 3.10 or later. If unable to upgrade, you must use `binpacking` version < 2.0.0 (e.g., `pip install binpacking==1.5.2`).
Ensure your build environment supports PEP 517/518 and `pyproject.toml` for packaging operations.
Always upgrade to version 2.0.1 or later (`pip install --upgrade binpacking`) to resolve this compatibility issue. Version 2.0.1 replaced PEP 695 syntax with TypeVar-based generics for broader compatibility.
Install with `pip install binpacking[numpy]`.
Ensure `pytest-runner` is not a direct or indirect dependency in your project to avoid potential security risks. Upgrade to `binpacking` v1.5.2 or newer.