Registry / data / binpacking

binpacking

JSON →
library2.0.1pypypi✓ verified 83d ago

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 binpacking
INSTALL
IMPORT
SIG · BINPACKING
B
binpacking
datapythonv2.0.1
Install
2.5s avg
Import
15ms
Disk
74MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 0.016s · 89.6MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 2.5s · import 0.015s · 86MB
74MB installed
● package 74MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

to_constant_volume
from binpacking import to_constant_volume
import binpacking
to_constant_bin_number
from binpacking import to_constant_bin_number
import binpacking
load_csv
from binpacking import load_csv
import binpacking

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.

import binpacking # Example 1: Pack items into bins with a constant volume limit items_by_weight = {'itemA': 10, 'itemB': 20, 'itemC': 30, 'itemD': 40, 'itemE': 15} max_bin_volume = 50 bins_constant_volume = binpacking.to_constant_volume(items_by_weight, max_bin_volume) print(f"Bins (constant volume {max_bin_volume}): {bins_constant_volume}") # Example 2: Pack items into a fixed number of bins num_target_bins = 2 bins_multiple_bins = binpacking.to_multiple_bins(items_by_weight, num_target_bins) print(f"Bins (fixed number {num_target_bins}): {bins_multiple_bins}") # For NumPy accelerated functions, ensure it's installed via: pip install binpacking[numpy] # from binpacking.matrices import to_constant_volume_numpy # (advanced usage)
Debug
Known issues
breakingVersion 2.0.0 and above require Python 3.10 or newer. Older Python 3 versions (e.g., 3.8, 3.9) and Python 2.x are no longer supported.
fix
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`).
affects: >=2.0.0
breakingThe packaging system transitioned from `setup.py`/`setup.cfg` to `pyproject.toml` in version 2.0.0. This primarily affects maintainers or developers building from source, but it's part of the modernization effort.
fix
Ensure your build environment supports PEP 517/518 and `pyproject.toml` for packaging operations.
affects: >=2.0.0
gotchaVersion 2.0.0 had a bug related to PEP 695 generic syntax compatibility with certain Python 3.10/3.11 environments, which could lead to runtime errors.
fix
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.
affects: 2.0.0
gotchaTo leverage NumPy for accelerated performance, you must explicitly install `binpacking` with the `[numpy]` extra. Standard installation does not include NumPy, and any attempts to use NumPy-specific features will fail.
fix
Install with `pip install binpacking[numpy]`.
affects: >=2.0.0
deprecatedThe `pytest-runner` dependency was removed in v1.5.2 due to security concerns.
fix
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.
affects: All versions
Upgrade
Version history
2.0.1latest on PyPI · released Jan 22, 2026
Audit
Dependencies
numpyoptionalOptional dependency for accelerated performance on large datasets. Install with `pip install binpacking[numpy]`.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
binpacking — pip install binpacking · libregistry