--- id: stretchable version: "1.1.8" license: unclear license_treatment: permissive maintenance: aging --- # stretchable — Layout library for Python (based on Taffy, a rust-powered implementation of CSS Grid/Flexbox) License: permissive · Maintenance: aging · Downloads: 106.2K/mo ## What it is and what it does stretchable is a Python binding to Taffy, a Rust implementation of CSS layout algorithms (Block, Flexbox, and Grid). It lets you build a tree of layout nodes, assign CSS-like properties (margin, padding, size, flex rules), and compute final positions and dimensions—all without a browser or DOM. The library is context-agnostic, so it works equally well for UI frameworks, report generators, plotting systems, or any application needing deterministic layout math. The package ships as pre-compiled wheels for modern Python versions (3.8–3.13) across Windows, macOS (Intel and ARM), and Linux (glibc and musl). It has one runtime dependency (attrs) and is typed. Development is steady but aging; the last release was 289 days ago, and the repository shows no signs of abandonment but also no rapid iteration. Use it for: - Build responsive UI layouts for terminal applications or custom frameworks without HTML/CSS parsing. - Generate page layouts for PDF reports or complex data visualizations where CSS-like rules simplify positioning. - Compute plot layouts for multi-panel scientific figures with automatic spacing and alignment. - Prototype layout logic in Python before porting to web or native frontends that use the same CSS spec. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. stretchable is a Python layout engine that implements CSS Block, Flexbox, and CSS Grid layout algorithms, enabling programmatic UI and report layouts without browser dependencies. Yes, if you need deterministic CSS-like layout computation in Python. The library is stable (Production/Stable classifier), well-typed, permissively licensed, and covers common platforms. Install friction is moderate due to compiled bindings, but wheels are pre-built. Maintenance is aging (289 days since last release) but not stalled; verify that the API and test coverage meet your edge-case needs before committing to a critical path. ## Install pip install stretchable uv add stretchable poetry add stretchable ## Installing stretchable Before you install: Medium install friction due to compiled Rust bindings, but pre-built wheels cover common platforms (x86_64, ARM, Windows, macOS, Linux). Last release 289 days ago; repository active with no archived status, though maintenance pace is aging. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: from stretchable import Node from stretchable.style import AUTO, PCT root = Node(margin=20, size=(500, 300)).add( Node(border=5, size=(50 * PCT, AUTO)), Node(key="child", padding=10 * PCT, size=50 * PCT), ) root.compute_layout() child_node = root.find("/child") print(child_node.get_box()) Verify before relying: - Whether the ~900 test suite (including Selenium-based tests) reflects real-world layout accuracy across edge cases. - Performance characteristics when laying out very large node trees or deeply nested structures. - Stability and API surface coverage compared to the original Stretch library it replaced. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: medium - Maintenance: aging - Downloads: 106.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags css layout engine python, flexbox grid layout library, python layout computation, css block layout algorithm, taffy rust layout bindings, layout-engine, css-algorithms, rust-bindings [View on SkillFed](https://skillfed.io/packages/stretchable) · [View on PyPI](https://pypi.org/project/stretchable/)