Python bindings for Facebook Yoga flexbox layout engine
Project description
pyyoga
Python bindings for Facebook Yoga flexbox layout engine.
Installation
pip install .
Quick Start
from pyyoga import Node, FlexDirection, Align, Justify
# Create a root node
root = Node()
root.width = 300
root.height = 400
root.flex_direction = FlexDirection.Column
root.align_items = Align.Center
# Add a child
child = Node()
child.width = 100
child.height = 100
root.add_child(child)
# Calculate layout
root.calculate_layout()
# Read results
print(f"Child position: ({child.layout_left}, {child.layout_top})")
print(f"Child size: {child.layout_width}x{child.layout_height}")
Features
- Full binding to Yoga C++ API via pybind11
- Pythonic wrapper with properties and idiomatic API
- All Yoga enums exposed as Python enums
- Support for custom configurations
- Child management with Python list semantics
Building from Source
Requirements:
- Python 3.10+
- C++20 compiler
- CMake 3.18+
pip install scikit-build-core pybind11
pip install -e .
Running Tests
pip install pytest
pytest tests/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyyoga-0.0.0.tar.gz
(10.0 kB
view details)
File details
Details for the file pyyoga-0.0.0.tar.gz.
File metadata
- Download URL: pyyoga-0.0.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bfdf979a9dd13b27926d2f9f4cfec32dce11bc4ab7eebcbdbb591c7016d59fb
|
|
| MD5 |
28224451eda1cc2e99688a67b843b50e
|
|
| BLAKE2b-256 |
1e1a75c1d6b97782d9001ca61099473f5d7bbec5feb150affbdeb4f925c69e54
|