rectangle-packer is a Python library for efficiently packing a set of 2D rectangles into a minimal bounding box. It utilizes an optimized best-fit heuristic algorithm to achieve high packing density. The current stable version is 2.1.0, and it maintains a moderate release cadence, with updates addressing performance and edge cases, primarily focusing on its core `pack` functionality.
pip install rectangle-packerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a list of rectangles as (width, height) tuples and use `rpack.pack()` to find their optimal positions within a minimal bounding box. It then prints the calculated (x, y) positions for each rectangle and the overall dimensions of the packed area.
Migrate any usage of `rpack.group` or direct calls to `rpack._rpack.pack` to use `rpack.pack` directly. The `pack` function is now the sole public API for packing.
Upgrade to version 2.1.0 or newer. This version introduced bigint preprocessing, including `gcd` normalization and power-of-two scaling, to robustly handle very large Python integers.
Upgrade to version 2.1.0 or newer. This version significantly improved `rpack.pack()` search behavior for such inputs by adding staged coarse candidate stepping with bounded local refinement.
Upgrade to `rectangle-packer` version 2.0.6 or newer and use `rpack.pack` directly. If you need to pack independent sets of rectangles, call `rpack.pack` for each set.
Upgrade to `rectangle-packer` version 2.0.6 or newer. The core packing functionality is now directly exposed via `rpack.pack`. Avoid importing internal modules directly.
Upgrade to `rectangle-packer` version 2.1.0 or newer. This version includes robust bigint preprocessing to handle large Python integers correctly without overflow.
No dependency data recorded yet.