{"id":28308,"library":"stretchable","title":"Stretchable","description":"A Python layout library that uses Taffy, a Rust-powered implementation of CSS Grid and Flexbox, to compute layouts declaratively. Current version is 1.1.8, supporting Python >=3.8. Release cadence is irregular, approximately bi-monthly.","status":"active","version":"1.1.8","language":"python","source_language":"en","source_url":"https://github.com/mortencombat/stretchable","tags":["layout","css-grid","flexbox","taffy","rust","gui"],"install":[{"cmd":"pip install stretchable","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from stretchable import Auto","symbol":"Box","correct":"from stretchable import Box"},{"symbol":"Node","correct":"from stretchable import Node"},{"symbol":"Style","correct":"from stretchable import Style"}],"quickstart":{"code":"from stretchable import Node, LayoutTree, Style\n\n# Create a root node with flexbox layout\nroot = Node(style=Style(size={\"width\": 100, \"height\": 100}, display=\"flex\", flex_direction=\"column\", gap=10))\nchild1 = Node(style=Style(size={\"width\": 50, \"height\": 30}))\nchild2 = Node(style=Style(size={\"width\": 50, \"height\": 30}))\n\n# Build and compute layout\ntree = LayoutTree(root)\nroot.add_child(child1)\nroot.add_child(child2)\ntree.compute_layout()\n\n# Print layout of child1\nlayout = tree.get_layout(child1)\nprint(f\"Child1: left={layout.left}, top={layout.top}, width={layout.width}, height={layout.height}\")","lang":"python","description":"Quickstart: create nodes, add children, compute layout, and access results."},"warnings":[{"fix":"Call root.add_child(child) before tree.compute_layout().","message":"Nodes must be added as children before calling tree.compute_layout(), otherwise they are not part of the layout calculation.","severity":"gotcha","affected_versions":"all"},{"fix":"Refer to migration notes in GitHub releases. For custom measure functions, ensure they match the new signature (width, height, available_width, available_height).","message":"Upgrade to v1.1.0 introduced breaking changes due to Taffy 0.5.1 upgrade. CSS Block layout and overflow support were added; some APIs changed (e.g., measure function signatures).","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"Use dictionary format: size={'width': 100, 'height': 50}.","message":"The size property in Style expects a dictionary, not a tuple. Common mistake: using size=(100, 50) instead of size={\"width\": 100, \"height\": 50}.","severity":"gotcha","affected_versions":"all"},{"fix":"Use node.style_setter() or modify individual properties of node.style (e.g., node.style.flex_direction = 'row').","message":"Direct assignment to Node.style (e.g., node.style = new_style) is deprecated after v1.1.1. Use setter method or property assignment carefully.","severity":"deprecated","affected_versions":">=1.1.1"}],"env_vars":null,"search_vec":"'1.1.8':26 '3.8':29 'approxim':34 'bi':36 'bi-month':35 'cadenc':31 'comput':20 'css':15,40 'css-grid':39 'current':23 'declar':22 'flexbox':18,42 'grid':16,41 'gui':45 'implement':13 'irregular':33 'layout':4,21,38 'librari':5 'month':37 'power':12 'python':3,28 'releas':30 'rust':11,44 'rust-pow':10 'stretchabl':1 'support':27 'taffi':8,43 'use':7 'version':24","created_at":"2026-05-09T05:54:49.601071+00:00","updated_at":"2026-05-09T05:54:49.601071+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://stretchable.readthedocs.io/en/latest/","github":"https://github.com/mortencombat/stretchable","docs":"https://stretchable.readthedocs.io/en/latest/","changelog":null,"pypi":"https://pypi.org/project/stretchable/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}