--- id: rectpack version: "0.2.2" license: Apache-2.0 license_treatment: permissive maintenance: abandoned --- # rectpack — 2D Rectangle packing library License: permissive · Maintenance: abandoned · Downloads: 109.7K/mo ## 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 above — verify before relying. Rectpack solves the 2D bin packing problem by arranging rectangles into the smallest number of bins using configurable heuristic algorithms (Skyline, MaxRects, Guillotine) with support for online and offline modes. 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 pip install rectpack uv add rectpack poetry add rectpack ## Installing rectpack 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. 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})") 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. 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: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 109.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags 2d rectangle packing, bin packing algorithm, knapsack problem solver, rectangle layout optimization, 2d bin packing library, rectangle arrangement, packing heuristics, bin-packing, geometry-optimization, abandoned [View on SkillFed](https://skillfed.io/packages/rectpack) · [View on PyPI](https://pypi.org/project/rectpack/)