rectpack
2D Rectangle packing library
Decision gist · record as of 2026-08-14
Yes, if you need a lightweight 2D packing solver and can tolerate abandoned software. The library is stable for its core use case, has no dependencies, and works well for offline packing problems. However, do not use it if you require active maintenance, compatibility with recent Python versions, or ongoing algorithm improvements. Test thoroughly on your target Python version before production deployment.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- All rectangle and bin dimensions must be integers or Decimals; floating-point values will cause rounding collisions.
- Use the provided float2dec helper to convert floats safely.
- Installation requires building from source (high friction).
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the code freely as long as you include the license notice.
last release 2021-11-24 (1724 days) · last repo commit 2021-11-24 · 562 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 109,668 downloads/mo, #12,504 on PyPI
Alternatives
Verify before relying
pip install rectpack
from rectpack import newPacker
packer = newPacker()
for w, h in [(100, 30), (40, 60)]:
packer.add_rect(w, h)
for w, h in [(300, 450), (200, 150)]:
packer.add_bin(w, h)
packer.pack()
for b, x, y, w, h, rid in packer.rect_list():
print(f"Bin {b}: rect at ({x}, {y})")- Whether the package works reliably on modern Python versions given its abandoned status and alpha classification.
- Performance characteristics and scalability limits for large packing problems.
- Whether any of the algorithm variants (MaxRects, Skyline, Guillotine) are documented as better for specific use cases beyond the brief recommendation.
What it is and what it does
Rectpack is a 2D bin packing library that takes a set of rectangles and arranges them into the smallest number of rectangular bins using heuristic algorithms. It implements three major packing strategies—Skyline, MaxRects, and Guillotine—each with multiple variants, allowing you to trade off between packing quality and speed. The library supports both offline mode (pack all rectangles at once after they're added) and online mode (pack rectangles as they arrive), with configurable options for bin selection, rectangle sorting, and rotation.
You define rectangles and bins by their dimensions, add them to a packer object, call pack(), and then retrieve the results as a list of (bin_index, x, y, width, height, id) tuples showing where each rectangle ended up. The package has no external runtime dependencies and handles the core algorithmic work internally. However, it requires exact integer or Decimal dimensions to avoid floating-point rounding errors, and it is marked abandoned with no maintenance since late 2021.
Use it for
- Texture atlas generation for game engines or graphics applications where sprites must be packed into minimal texture sheets.
- Print layout optimization to arrange images and text blocks on pages or posters with minimal waste.
- Warehouse or container loading where physical items must fit into the fewest trucks or storage bins.
- Cutting stock problems in manufacturing where material sheets are cut into smaller pieces with minimal scrap.
- UI layout algorithms where widgets or panels must be arranged into fixed-size containers on a screen.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need a lightweight 2D packing solver and can tolerate abandoned software.
The library is stable for its core use case, has no dependencies, and works well for offline packing problems. However, do not use it if you require active maintenance, compatibility with recent Python versions, or ongoing algorithm improvements. Test thoroughly on your target Python version before production deployment.
Install
rectpack on PyPI
Before you install
Installation requires building from source (high friction). The package is marked abandoned with no commits since 2021-11-24. No runtime dependencies, but the lack of recent maintenance means bug fixes and compatibility updates are unlikely.
All rectangle and bin dimensions must be integers or Decimals; floating-point values will cause rounding collisions. Use the provided float2dec helper to convert floats safely.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the code freely as long as you include the license notice.
Quickstart
pip install rectpack
from rectpack import newPacker
packer = newPacker()
for w, h in [(100, 30), (40, 60)]:
packer.add_rect(w, h)
for w, h in [(300, 450), (200, 150)]:
packer.add_bin(w, h)
packer.pack()
for b, x, y, w, h, rid in packer.rect_list():
print(f"Bin {b}: rect at ({x}, {y})")
Verify before relying
- Whether the package works reliably on modern Python versions given its abandoned status and alpha classification.
- Performance characteristics and scalability limits for large packing problems.
- Whether any of the algorithm variants (MaxRects, Skyline, Guillotine) are documented as better for specific use cases beyond the brief recommendation.
Package facts
| License | Apache-2.0 permissive |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Abandoned 1,724 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 109,668 / month, #12,504 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3 |
Evidence: rectpack-0.2.2.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “2d rectangle packing”
- rectpackRectpack solves the 2D bin packing problem by arranging rectangles…
- rectangle-packerPacks a set of rectangles with fixed orientations into a minimal-area…
- py3dbpSolves the 3D bin packing problem by fitting items into bins while…
Give your agent the search over MCP, or paste the wish link into any chat.
More Mathematics packages
NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.
kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.
Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.
SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.
ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.
PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.
onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.
Install it if you have ONNX models to run in production or development.
See also py3dbp · rectangle-packer · squarify · binpacking · PyRect · prtpy · munkres · PyWinBox · optbinning