Skip to main content

Layout library for Python (based on Taffy, a rust-powered implementation of CSS Grid/Flexbox)

Project description

Introduction

This package enables target-agnostic layout operations using CSS Grid and Flexbox. Possible uses include UI layouts, page layouts for reports, complex plotting layouts, etc.

It implements Python bindings for Taffy, an implementation of Grid/Flexbox written in Rust. It was originally based on Stretch (hence the name), but has since migrated to use Taffy.

Getting Started

Helpful resources to getting started with layouts using CSS Grid and Flexbox are listed below.

Flexbox

  • Flexbox Froggy. This is an interactive tutorial/game that allows you to learn the essential parts of Flexbox in a fun engaging way.
  • A Complete Guide To Flexbox by CSS Tricks. This is detailed guide with illustrations and comphrehensive written explanation of the different Flexbox properties and how they work.
  • Yoga Playground

CSS Grid

  • CSS Grid Garden. This is an interactive tutorial/game that allows you to learn the essential parts of CSS Grid in a fun engaging way.
  • A Complete Guide To CSS Grid by CSS Tricks. This is detailed guide with illustrations and comphrehensive written explanation of the different CSS Grid properties and how they work.

Usage

See demos for examples of basic usage.

Building

Install Rust with rustup and use maturin develop for development and maturin build [--release] to build.

Testing

Install test dependencies and invoke pytest. Note that there are ~700 tests, the majority of which are run using Selenium with the Chrome WebDriver, and the complete test suite can take 10+ minutes to complete. Use pytest --lf to only run the last-failed tests.

NOTE: There is one test fixture max_height_overrides_height_on_root which is known to fail. This is related to node visibility, see #43.

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

stretchable-1.0.0b2-cp38-abi3-win_arm64.whl (293.4 kB view hashes)

Uploaded CPython 3.8+ Windows ARM64

stretchable-1.0.0b2-cp38-abi3-win_amd64.whl (319.6 kB view hashes)

Uploaded CPython 3.8+ Windows x86-64

stretchable-1.0.0b2-cp38-abi3-win32.whl (281.4 kB view hashes)

Uploaded CPython 3.8+ Windows x86

stretchable-1.0.0b2-cp38-abi3-musllinux_1_2_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8+ musllinux: musl 1.2+ x86-64

stretchable-1.0.0b2-cp38-abi3-musllinux_1_2_aarch64.whl (1.5 MB view hashes)

Uploaded CPython 3.8+ musllinux: musl 1.2+ ARM64

stretchable-1.0.0b2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

stretchable-1.0.0b2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

stretchable-1.0.0b2-cp38-abi3-macosx_11_0_arm64.whl (442.3 kB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

stretchable-1.0.0b2-cp38-abi3-macosx_10_7_x86_64.whl (482.8 kB view hashes)

Uploaded CPython 3.8+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page