--- id: rectangle-packer version: "2.1.0" license: MIT license_treatment: permissive maintenance: active --- # rectangle-packer — Pack a set of rectangles into a bounding box with minimum area License: permissive · Maintenance: active · Downloads: 207.7K/mo ## What it is and what it does rectangle-packer is a Python library that solves the 2D rectangle packing problem: given a collection of rectangles with fixed dimensions, it arranges them into a bounding box with minimal area and no overlaps. The package is implemented in C for performance and exposes a simple Python API that takes a list of (width, height) tuples and returns the (x, y) coordinates where each rectangle should be placed. The library targets developers working on layout problems in graphics, game engines, texture atlasing, or any domain requiring efficient spatial arrangement of rectangular objects. It has no runtime dependencies and supports modern Python versions (3.9 through 3.14) across Linux, macOS, and Windows with precompiled wheels. Use it for: - Generate texture atlases for game engines by packing sprite sheets into minimal-area canvases. - Optimize UI layout in graphics applications by arranging rectangular elements with minimal wasted space. - Arrange rectangular bins or containers in warehouse or logistics planning simulations. - Pack rectangular images or tiles into a single image file for efficient storage and rendering. - Solve bin-packing problems in manufacturing or material-cutting scenarios. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Packs a set of rectangles with fixed orientations into a minimal-area bounding box with no overlaps, returning the (x, y) coordinates of each rectangle's lower-left corner. Yes. The package is stable (Production/Stable status), actively maintained, has no known vulnerabilities, and solves a well-defined problem with a clean API. The medium install friction is offset by precompiled wheels for common platforms and Python versions. Install it if you need to pack rectangles efficiently. ## Install pip install rectangle-packer uv add rectangle-packer poetry add rectangle-packer ## Installing rectangle-packer Before you install: Medium install friction due to compiled wheels for multiple platforms and Python versions (3.9–3.14). Active maintenance with recent release (155 days ago) and no known vulnerabilities. License in practice: MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions. Quickstart: python3 -m pip install rectangle-packer Import the module and call pack() with a list of (width, height) tuples to get (x, y) coordinates for each rectangle's lower-left corner. Requires Python 3.9 or later. Verify before relying: - Whether the packing algorithm guarantees optimal solutions or uses a heuristic approach. - Performance characteristics (time/space complexity) for large numbers of rectangles. - Whether rectangles can be rotated or only placed in fixed orientations. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 207.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags rectangle packing algorithm, 2D bin packing, rectangle layout optimization, minimize bounding box area, pack rectangles no overlap, 2D rectangle placement, enclosing bounding box, geometry, optimization, spatial-layout [View on SkillFed](https://skillfed.io/packages/rectangle-packer) · [View on PyPI](https://pypi.org/project/rectangle-packer/)