yoga-python 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yoga_python-0.1.2/.github/workflows/quality.yml +81 -0
- yoga_python-0.1.2/.github/workflows/release.yml +193 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/.gitignore +4 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/CMakeLists.txt +3 -4
- yoga_python-0.1.2/LICENSE +21 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/PKG-INFO +21 -7
- {yoga_python-0.1.0 → yoga_python-0.1.2}/README.md +4 -4
- {yoga_python-0.1.0 → yoga_python-0.1.2}/pyproject.toml +24 -4
- {yoga_python-0.1.0 → yoga_python-0.1.2}/src/yoga/__init__.py +1 -1
- {yoga_python-0.1.0 → yoga_python-0.1.2}/src/yoga/__init__.pyi +3 -3
- yoga_python-0.1.2/src/yoga/py.typed +0 -0
- yoga_python-0.1.2/src/yoga/yoga.cpp +1021 -0
- yoga_python-0.1.2/tests/test_clone_nofree.py +51 -0
- yoga_python-0.1.2/tests/test_free_order.py +134 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_measure.py +1 -0
- yoga_python-0.1.2/tests/test_no_free.py +48 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_persistence.py +3 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_persistent_node_cloning.py +3 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_value.py +1 -2
- {yoga_python-0.1.0 → yoga_python-0.1.2}/uv.lock +12 -2
- yoga_python-0.1.0/.github/workflows/quality.yml +0 -54
- yoga_python-0.1.0/.github/workflows/release.yml +0 -159
- yoga_python-0.1.0/src/yoga/enums.py +0 -132
- yoga_python-0.1.0/src/yoga/value.py +0 -54
- yoga_python-0.1.0/src/yoga/yoga.cpp +0 -1085
- {yoga_python-0.1.0 → yoga_python-0.1.2}/.github/workflows/create-release.yml +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/.python-version +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/pyrightconfig.json +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/conftest.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_absolute_position.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_align_content.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_align_items.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_align_self.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_android_news_feed.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_aspect_ratio.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_auto.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_baseline.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_baseline_func.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_border.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_box_sizing.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_clone_node.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_computed_margin.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_computed_padding.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_config.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_default_values.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_dimension.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_dirtied.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_dirty_marking.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_display.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_display_contents.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_edge.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_events.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_flex.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_flex_direction.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_flex_gap.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_flex_wrap.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_float_optional.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_gap.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_had_overflow.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_intrinsic_size.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_justify_content.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_layoutable_children.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_margin.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_measure_cache.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_measure_mode.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_min_max_dimension.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_node_callback.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_node_child.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_ordinals.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_padding.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_percentage.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_relayout.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_rounding.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_rounding_function.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_rounding_measure.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_scale_change.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_size_overflow.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_small_value_buffer.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_static_position.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_style.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_style_value_pool.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_tree_mutation.py +0 -0
- {yoga_python-0.1.0 → yoga_python-0.1.2}/tests/test_zero_out_layout.py +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
run: uv python install ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies and build extension
|
|
26
|
+
run: uv sync --all-extras
|
|
27
|
+
|
|
28
|
+
- name: Lint with ruff
|
|
29
|
+
run: |
|
|
30
|
+
uv run ruff check
|
|
31
|
+
uv run ruff format --check
|
|
32
|
+
|
|
33
|
+
- name: Type check with pyright
|
|
34
|
+
run: uv run pyright
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: |
|
|
38
|
+
uv run pytest tests/ -v --tb=short --cov=src/yoga --cov-report=term-missing --cov-report=xml
|
|
39
|
+
|
|
40
|
+
- name: Upload coverage to Codecov
|
|
41
|
+
uses: codecov/codecov-action@v4
|
|
42
|
+
if: matrix.python-version == '3.12'
|
|
43
|
+
with:
|
|
44
|
+
file: ./coverage.xml
|
|
45
|
+
flags: unittests
|
|
46
|
+
name: codecov-umbrella
|
|
47
|
+
fail_ci_if_error: false
|
|
48
|
+
|
|
49
|
+
quality-check:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
needs: quality
|
|
52
|
+
steps:
|
|
53
|
+
- name: All quality checks passed
|
|
54
|
+
run: echo "✅ All quality checks passed!"
|
|
55
|
+
|
|
56
|
+
# Verify release build path (sdist + one Linux wheel) on main so we catch breakage before tagging
|
|
57
|
+
release-build-smoke:
|
|
58
|
+
name: Release build (sdist + Linux wheel)
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
- name: Install uv
|
|
64
|
+
uses: astral-sh/setup-uv@v4
|
|
65
|
+
- name: Build sdist
|
|
66
|
+
run: pip install -q build validate-pyproject && validate-pyproject pyproject.toml && python -m build --sdist
|
|
67
|
+
- name: Build one Linux wheel (cibuildwheel smoke)
|
|
68
|
+
uses: pypa/cibuildwheel@v2.22.0
|
|
69
|
+
env:
|
|
70
|
+
CIBW_BUILD: "cp312-*"
|
|
71
|
+
CIBW_SKIP: "*-win* *-macos* *-manylinux_i686 *-musllinux_*"
|
|
72
|
+
# Use manylinux_2_28 so pip can use ninja's manylinux_2_12 wheel (no compatible wheel on manylinux2014)
|
|
73
|
+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
|
|
74
|
+
# CMake FetchContent needs git (dnf for manylinux_2_28)
|
|
75
|
+
CIBW_BEFORE_ALL_LINUX: "dnf install -y git"
|
|
76
|
+
CIBW_BUILD_FRONTEND: "build[uv]"
|
|
77
|
+
CIBW_BUILD_VERBOSITY: "3"
|
|
78
|
+
CIBW_ENVIRONMENT_PASS_LINUX: "GIT_TERMINAL_PROMPT"
|
|
79
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
80
|
+
- name: List artifacts
|
|
81
|
+
run: ls -la wheelhouse/ dist/
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
name: 🚀 Release to PyPI and GitHub
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: "Version to release (e.g., 0.1.0)"
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build_wheels:
|
|
19
|
+
name: Build wheels (${{ matrix.os }})
|
|
20
|
+
runs-on: ${{ matrix.runs-on }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
include:
|
|
25
|
+
- os: linux
|
|
26
|
+
runs-on: ubuntu-22.04
|
|
27
|
+
- os: windows
|
|
28
|
+
runs-on: windows-latest
|
|
29
|
+
- os: macos
|
|
30
|
+
runs-on: macos-latest
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
fetch-depth: 0
|
|
36
|
+
|
|
37
|
+
- name: Install uv
|
|
38
|
+
uses: astral-sh/setup-uv@v4
|
|
39
|
+
|
|
40
|
+
- name: Build wheels
|
|
41
|
+
uses: pypa/cibuildwheel@v2.22.0
|
|
42
|
+
env:
|
|
43
|
+
CIBW_BUILD: "cp312-* cp313-* cp314-*"
|
|
44
|
+
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
|
|
45
|
+
# Use manylinux_2_28 so pip can use ninja's wheel (no compatible wheel on manylinux2014)
|
|
46
|
+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
|
|
47
|
+
# CMake FetchContent clones Yoga from GitHub (dnf for manylinux_2_28)
|
|
48
|
+
CIBW_BEFORE_ALL_LINUX: "dnf install -y git"
|
|
49
|
+
# Test built wheels before shipping
|
|
50
|
+
CIBW_TEST_REQUIRES: "pytest"
|
|
51
|
+
CIBW_TEST_COMMAND: "pytest {project}/tests -v --tb=short -x"
|
|
52
|
+
# Prevent git from hanging on auth prompts during FetchContent
|
|
53
|
+
CIBW_ENVIRONMENT_PASS_LINUX: "GIT_TERMINAL_PROMPT"
|
|
54
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
55
|
+
CIBW_BUILD_FRONTEND: "build[uv]"
|
|
56
|
+
CIBW_BUILD_VERBOSITY: "1"
|
|
57
|
+
|
|
58
|
+
- uses: actions/upload-artifact@v4
|
|
59
|
+
with:
|
|
60
|
+
name: wheels-${{ matrix.os }}
|
|
61
|
+
path: wheelhouse/*.whl
|
|
62
|
+
|
|
63
|
+
build_sdist:
|
|
64
|
+
name: Build sdist
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/checkout@v4
|
|
68
|
+
with:
|
|
69
|
+
fetch-depth: 0
|
|
70
|
+
|
|
71
|
+
- name: Install build
|
|
72
|
+
run: pip install -q build
|
|
73
|
+
|
|
74
|
+
- name: Validate pyproject.toml
|
|
75
|
+
run: pip install -q validate-pyproject && validate-pyproject pyproject.toml
|
|
76
|
+
|
|
77
|
+
- name: Build sdist
|
|
78
|
+
run: python -m build --sdist
|
|
79
|
+
|
|
80
|
+
- uses: actions/upload-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
name: sdist
|
|
83
|
+
path: dist/*.tar.gz
|
|
84
|
+
|
|
85
|
+
publish-to-pypi:
|
|
86
|
+
name: 🚀 Publish to PyPI
|
|
87
|
+
needs: [build_wheels, build_sdist]
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
90
|
+
environment:
|
|
91
|
+
name: pypi
|
|
92
|
+
url: https://pypi.org/p/yoga-python
|
|
93
|
+
permissions:
|
|
94
|
+
id-token: write
|
|
95
|
+
contents: write
|
|
96
|
+
|
|
97
|
+
steps:
|
|
98
|
+
- name: Download all artifacts
|
|
99
|
+
uses: actions/download-artifact@v4
|
|
100
|
+
with:
|
|
101
|
+
path: dist
|
|
102
|
+
merge-multiple: true
|
|
103
|
+
|
|
104
|
+
- name: Flatten dist (artifacts are in dist/wheels-* and dist/sdist)
|
|
105
|
+
run: |
|
|
106
|
+
mkdir -p dist/merged
|
|
107
|
+
find dist -maxdepth 3 -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} dist/merged/ \;
|
|
108
|
+
rm -rf dist/wheels-* dist/sdist
|
|
109
|
+
mv dist/merged/* dist/
|
|
110
|
+
rmdir dist/merged
|
|
111
|
+
ls -la dist/
|
|
112
|
+
|
|
113
|
+
- name: Publish to PyPI
|
|
114
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
115
|
+
with:
|
|
116
|
+
print-hash: true
|
|
117
|
+
|
|
118
|
+
publish-to-testpypi:
|
|
119
|
+
name: 🧪 Publish to TestPyPI
|
|
120
|
+
needs: [build_wheels, build_sdist]
|
|
121
|
+
runs-on: ubuntu-latest
|
|
122
|
+
if: github.event_name == 'workflow_dispatch'
|
|
123
|
+
environment:
|
|
124
|
+
name: test-pypi
|
|
125
|
+
url: https://test.pypi.org/p/yoga-python
|
|
126
|
+
permissions:
|
|
127
|
+
id-token: write
|
|
128
|
+
|
|
129
|
+
steps:
|
|
130
|
+
- name: Download all artifacts
|
|
131
|
+
uses: actions/download-artifact@v4
|
|
132
|
+
with:
|
|
133
|
+
path: dist
|
|
134
|
+
merge-multiple: true
|
|
135
|
+
|
|
136
|
+
- name: Flatten dist
|
|
137
|
+
run: |
|
|
138
|
+
mkdir -p dist/merged
|
|
139
|
+
find dist -maxdepth 3 -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} dist/merged/ \;
|
|
140
|
+
rm -rf dist/wheels-* dist/sdist
|
|
141
|
+
mv dist/merged/* dist/
|
|
142
|
+
rmdir dist/merged
|
|
143
|
+
ls -la dist/
|
|
144
|
+
|
|
145
|
+
- name: Publish to TestPyPI
|
|
146
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
147
|
+
with:
|
|
148
|
+
repository-url: https://test.pypi.org/legacy/
|
|
149
|
+
print-hash: true
|
|
150
|
+
|
|
151
|
+
create-github-release:
|
|
152
|
+
name: 📋 Create GitHub Release
|
|
153
|
+
needs: [publish-to-pypi]
|
|
154
|
+
runs-on: ubuntu-latest
|
|
155
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
156
|
+
permissions:
|
|
157
|
+
contents: write
|
|
158
|
+
|
|
159
|
+
steps:
|
|
160
|
+
- uses: actions/checkout@v4
|
|
161
|
+
with:
|
|
162
|
+
fetch-depth: 0
|
|
163
|
+
|
|
164
|
+
- name: Download all artifacts
|
|
165
|
+
uses: actions/download-artifact@v4
|
|
166
|
+
with:
|
|
167
|
+
path: dist
|
|
168
|
+
merge-multiple: true
|
|
169
|
+
|
|
170
|
+
- name: Flatten dist for release upload
|
|
171
|
+
run: |
|
|
172
|
+
mkdir -p release_assets
|
|
173
|
+
find dist -maxdepth 3 -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} release_assets/ \;
|
|
174
|
+
ls -la release_assets/
|
|
175
|
+
|
|
176
|
+
- name: Determine release type
|
|
177
|
+
id: release-type
|
|
178
|
+
run: |
|
|
179
|
+
if [[ ${{ github.ref_name }} =~ -alpha|-beta|-rc ]]; then
|
|
180
|
+
echo "prerelease=true" >> $GITHUB_OUTPUT
|
|
181
|
+
else
|
|
182
|
+
echo "prerelease=false" >> $GITHUB_OUTPUT
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
- name: Create GitHub Release
|
|
186
|
+
run: |
|
|
187
|
+
gh release create ${{ github.ref_name }} \
|
|
188
|
+
--title "yoga-python ${{ github.ref_name }}" \
|
|
189
|
+
--generate-notes \
|
|
190
|
+
${{ steps.release-type.outputs.prerelease == 'true' && '--prerelease' || '--latest' }} \
|
|
191
|
+
release_assets/*
|
|
192
|
+
env:
|
|
193
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -8,14 +8,14 @@ endif()
|
|
|
8
8
|
|
|
9
9
|
set(CMAKE_CXX_STANDARD 20)
|
|
10
10
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
11
|
-
|
|
11
|
+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
|
12
|
+
find_package(nanobind REQUIRED)
|
|
12
13
|
|
|
13
14
|
set(yoga_BUILD_TESTS OFF CACHE BOOL "Build Yoga tests" FORCE)
|
|
14
15
|
|
|
15
16
|
# Use local reference yoga if present, otherwise fetch from GitHub
|
|
16
17
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/reference/yoga/CMakeLists.txt)
|
|
17
18
|
message(STATUS "Using local reference yoga")
|
|
18
|
-
find_package(pybind11 REQUIRED)
|
|
19
19
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/reference/yoga ${CMAKE_BINARY_DIR}/yoga-build EXCLUDE_FROM_ALL)
|
|
20
20
|
else()
|
|
21
21
|
message(STATUS "Fetching yoga from GitHub...")
|
|
@@ -38,8 +38,7 @@ else()
|
|
|
38
38
|
add_subdirectory(${yoga_SOURCE_DIR} ${CMAKE_BINARY_DIR}/yoga-build EXCLUDE_FROM_ALL)
|
|
39
39
|
endif()
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
pybind11_add_module(yoga src/yoga/yoga.cpp)
|
|
41
|
+
nanobind_add_module(yoga src/yoga/yoga.cpp)
|
|
43
42
|
target_include_directories(yoga PRIVATE ${yoga_SOURCE_DIR})
|
|
44
43
|
target_link_libraries(yoga PRIVATE yogacore)
|
|
45
44
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 firefly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: yoga-python
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: Python
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Python bindings for Facebook Yoga layout engine (CSS Flexbox)
|
|
5
|
+
Keywords: yoga,flexbox,layout,css,react-native
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: C++
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Project-URL: Homepage, https://github.com/banditburai/yoga-python
|
|
16
|
+
Project-URL: Repository, https://github.com/banditburai/yoga-python
|
|
17
|
+
Project-URL: Issues, https://github.com/banditburai/yoga-python/issues
|
|
5
18
|
Requires-Python: >=3.12
|
|
6
19
|
Provides-Extra: dev
|
|
7
20
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
8
21
|
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
9
22
|
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
23
|
+
Requires-Dist: pyright>=1.1.408; extra == "dev"
|
|
10
24
|
Description-Content-Type: text/markdown
|
|
11
25
|
|
|
12
26
|
# yoga-python
|
|
13
27
|
|
|
14
28
|
Python bindings for [Facebook's Yoga](https://github.com/facebook/yoga) layout engine — a cross-platform implementation of [CSS Flexbox](https://www.w3.org/TR/css-flexbox-1/).
|
|
15
29
|
|
|
16
|
-
Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfect positions. This package wraps the full C++ engine via [
|
|
30
|
+
Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfect positions. This package wraps the full C++ engine via [nanobind](https://github.com/wjakob/nanobind), giving you the same layout behavior you get in React Native, Litho, and other Yoga-backed frameworks — directly from Python.
|
|
17
31
|
|
|
18
32
|
## Installation
|
|
19
33
|
|
|
@@ -21,10 +35,10 @@ Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfe
|
|
|
21
35
|
pip install yoga-python
|
|
22
36
|
```
|
|
23
37
|
|
|
24
|
-
Building from source requires a C++20 compiler, CMake 3.15+, and
|
|
38
|
+
Building from source requires a C++20 compiler, CMake 3.15+, and nanobind:
|
|
25
39
|
|
|
26
40
|
```bash
|
|
27
|
-
pip install scikit-build-core
|
|
41
|
+
pip install scikit-build-core nanobind
|
|
28
42
|
pip install .
|
|
29
43
|
```
|
|
30
44
|
|
|
@@ -170,7 +184,7 @@ YGValueUndefined # undefined
|
|
|
170
184
|
|
|
171
185
|
## Enums
|
|
172
186
|
|
|
173
|
-
All Yoga enums are available as Python enum types (
|
|
187
|
+
All Yoga enums are available as Python enum types (nanobind enums, int-convertible):
|
|
174
188
|
|
|
175
189
|
`Direction`, `FlexDirection`, `Justify`, `Align`, `PositionType`, `Wrap`, `Overflow`, `Display`, `Edge`, `Unit`, `MeasureMode`, `Dimension`, `BoxSizing`, `Gutter`, `Errata`, `NodeType`, `LogLevel`, `ExperimentalFeature`
|
|
176
190
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Python bindings for [Facebook's Yoga](https://github.com/facebook/yoga) layout engine — a cross-platform implementation of [CSS Flexbox](https://www.w3.org/TR/css-flexbox-1/).
|
|
4
4
|
|
|
5
|
-
Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfect positions. This package wraps the full C++ engine via [
|
|
5
|
+
Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfect positions. This package wraps the full C++ engine via [nanobind](https://github.com/wjakob/nanobind), giving you the same layout behavior you get in React Native, Litho, and other Yoga-backed frameworks — directly from Python.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -10,10 +10,10 @@ Yoga computes a layout tree of nodes with flexbox styles and outputs pixel-perfe
|
|
|
10
10
|
pip install yoga-python
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Building from source requires a C++20 compiler, CMake 3.15+, and
|
|
13
|
+
Building from source requires a C++20 compiler, CMake 3.15+, and nanobind:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pip install scikit-build-core
|
|
16
|
+
pip install scikit-build-core nanobind
|
|
17
17
|
pip install .
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -159,7 +159,7 @@ YGValueUndefined # undefined
|
|
|
159
159
|
|
|
160
160
|
## Enums
|
|
161
161
|
|
|
162
|
-
All Yoga enums are available as Python enum types (
|
|
162
|
+
All Yoga enums are available as Python enum types (nanobind enums, int-convertible):
|
|
163
163
|
|
|
164
164
|
`Direction`, `FlexDirection`, `Justify`, `Align`, `PositionType`, `Wrap`, `Overflow`, `Display`, `Edge`, `Unit`, `MeasureMode`, `Dimension`, `BoxSizing`, `Gutter`, `Errata`, `NodeType`, `LogLevel`, `ExperimentalFeature`
|
|
165
165
|
|
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "yoga-python"
|
|
3
|
-
version = "0.1.
|
|
4
|
-
description = "Python
|
|
3
|
+
version = "0.1.2"
|
|
4
|
+
description = "Python bindings for Facebook Yoga layout engine (CSS Flexbox)"
|
|
5
5
|
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
6
7
|
requires-python = ">=3.12"
|
|
7
8
|
dependencies = []
|
|
9
|
+
keywords = ["yoga", "flexbox", "layout", "css", "react-native"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Programming Language :: C++",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/banditburai/yoga-python"
|
|
23
|
+
Repository = "https://github.com/banditburai/yoga-python"
|
|
24
|
+
Issues = "https://github.com/banditburai/yoga-python/issues"
|
|
8
25
|
|
|
9
26
|
[project.optional-dependencies]
|
|
10
27
|
dev = [
|
|
11
28
|
"pytest>=8.0",
|
|
12
29
|
"pytest-cov>=4.1",
|
|
13
30
|
"ruff>=0.3",
|
|
31
|
+
"pyright>=1.1.408",
|
|
14
32
|
]
|
|
15
33
|
|
|
16
34
|
[build-system]
|
|
17
|
-
requires = ["scikit-build-core>=0.5", "
|
|
35
|
+
requires = ["scikit-build-core>=0.5", "nanobind>=2.0"]
|
|
18
36
|
build-backend = "scikit_build_core.build"
|
|
19
37
|
|
|
20
38
|
[tool.scikit-build]
|
|
@@ -76,7 +94,6 @@ ignore = [
|
|
|
76
94
|
"tests/archive/*.py" = ["F401", "I001", "PLR0915", "E712", "N803", "PLW1641", "F811", "PLR0913"]
|
|
77
95
|
"src/yoga/__init__.py" = ["F401", "I001", "SIM105"]
|
|
78
96
|
"src/yoga/__init__.pyi" = ["N815"]
|
|
79
|
-
"src/yoga/value.py" = ["I001", "PLW1641"]
|
|
80
97
|
"tests/conftest.py" = ["F401", "I001"]
|
|
81
98
|
|
|
82
99
|
[tool.ruff.format]
|
|
@@ -86,4 +103,7 @@ indent-style = "space"
|
|
|
86
103
|
[dependency-groups]
|
|
87
104
|
dev = [
|
|
88
105
|
"pyright>=1.1.408",
|
|
106
|
+
"pytest>=8.0",
|
|
107
|
+
"pytest-cov>=4.1",
|
|
108
|
+
"ruff>=0.3",
|
|
89
109
|
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Yoga Python bindings - Facebook Yoga layout engine
|
|
3
3
|
|
|
4
4
|
This package provides Python bindings for the Facebook Yoga layout engine.
|
|
5
|
-
Uses compiled C++
|
|
5
|
+
Uses compiled C++ nanobind extension.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from yoga.yoga import * # noqa: F401, F403 # type: ignore[import-not-found]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
|
-
# Enums (
|
|
4
|
+
# Enums (nanobind enum types)
|
|
5
5
|
class Direction:
|
|
6
6
|
Inherit: Direction
|
|
7
7
|
LTR: Direction
|
|
@@ -291,8 +291,8 @@ NodeBaselineEnd: EventType
|
|
|
291
291
|
# YGValue
|
|
292
292
|
class YGValue:
|
|
293
293
|
value: float
|
|
294
|
-
unit: int
|
|
295
|
-
def __init__(self, value: float, unit: int) -> None: ...
|
|
294
|
+
unit: Unit | int
|
|
295
|
+
def __init__(self, value: float, unit: Unit | int) -> None: ...
|
|
296
296
|
def __eq__(self, other: object) -> bool: ...
|
|
297
297
|
def __neg__(self) -> YGValue: ...
|
|
298
298
|
def __repr__(self) -> str: ...
|
|
File without changes
|