--- id: binpacking version: "2.0.1" license: MIT license_treatment: permissive maintenance: aging --- # binpacking — Heuristic distribution of weighted items to bins (either a fixed number of bins or a fixed number of volume per bin). Data may be in form of list, dictionary, list of tuples or csv-file. License: permissive · Maintenance: aging · Downloads: 265.7K/mo ## What it is and what it does binpacking solves two classic bin packing problems using greedy heuristics. The first distributes items into exactly N bins with approximately balanced total weight per bin (useful for load balancing across a fixed number of workers). The second distributes items into the minimum number of bins, each respecting a maximum capacity constraint (useful for minimizing resource allocations). The package accepts input as lists, dictionaries, lists of tuples, or CSV files, and includes both pure Python and optional NumPy-accelerated implementations. The algorithms are Least Loaded Fit Decreasing for constant-volume packing and Longest Processing Time for constant-bin-number packing. Both sort items by weight descending before placement. This is a straightforward, dependency-free tool for scheduling, resource allocation, and partitioning problems where exact optimality is less critical than a fast, reasonable solution. Use it for: - Distribute jobs with known durations across a fixed number of CPU cores to minimize total runtime. - Group files of different sizes into memory allocations to minimize the number of program runs needed. - Pack items into containers or shipments with a maximum weight limit to minimize the number of containers. - Partition data into batches for parallel processing while keeping batch sizes roughly equal. - Schedule tasks across servers with fixed capacity to balance load. - Bin CSV rows by a weight column for resource planning or logistics optimization. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Distributes weighted items into bins using greedy algorithms, either to a fixed number of bins with balanced loads or to the minimum bins with a maximum capacity constraint. Yes. The package solves a real, common problem with zero dependencies, low install friction, and a permissive license. The greedy algorithms are fast and adequate for most practical load-balancing and partitioning tasks. Maintenance is aging but the code is stable and the repository is not abandoned. Install it if you need to distribute weighted items across fixed bins or minimize bin count. ## Install pip install binpacking uv add binpacking poetry add binpacking ## Installing binpacking Before you install: Low friction: pure Python wheel with no required dependencies. Maintenance status is aging—last release 204 days ago, but the repository is active and not archived. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install binpacking import binpacking b = {'a': 10, 'b': 10, 'c': 11, 'd': 1, 'e': 2, 'f': 7} bins = binpacking.to_constant_bin_number(b, 4) print(bins) Requires Python 3.10+ Verify before relying: - How well the greedy algorithms perform compared to optimal solutions on typical problem sizes. - Whether NumPy acceleration provides meaningful speedup for the datasets you plan to pack. - Real-world accuracy of the Least Loaded Fit Decreasing and Longest Processing Time heuristics for your domain. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 265.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags bin packing algorithm, load balancing distribution, partition items into bins, constant volume packing, job scheduling to cores, weight distribution, greedy bin allocation, scheduling, resource-allocation, heuristic [View on SkillFed](https://skillfed.io/packages/binpacking) · [View on PyPI](https://pypi.org/project/binpacking/)