1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright (C) 2026 Tencent. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Bindings Python
on:
push:
branches:
paths:
- "bindings/python/**"
- "src/**"
- "proto/**"
- "Cargo.toml"
- "Cargo.lock"
- "scripts/release/python.sh"
- ".github/workflows/ci_bindings_python.yml"
- ".github/actions/**"
pull_request:
paths:
- "bindings/python/**"
- "src/**"
- "proto/**"
- "Cargo.toml"
- "Cargo.lock"
- "scripts/release/python.sh"
- ".github/workflows/ci_bindings_python.yml"
- ".github/actions/**"
workflow_dispatch:
concurrency:
group: python-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Lint / typecheck / stub validation.
#
# These are the four commands DEVELOPMENT.md tells contributors to run, and
# until now none of them ran in CI — the stubs had already drifted from the
# module (missing `Config` getters, `URIStatusList` absent from `__all__`)
# with nothing to catch it. A documented check that no job runs is not a
# check.
#
# Platform-independent, so one runner is enough; the wheel matrix below
# covers the per-OS build concerns.
lint:
name: lint + typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Rust
uses: ./.github/actions/setup
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Sync deps
working-directory: bindings/python
run: uv sync --all-extras --group dev --group test
# stubtest imports the real extension module and compares it against the
# stubs, so the module has to be built and installed first.
- name: Build binding
working-directory: bindings/python
run: uv run maturin develop --uv --release
- name: ruff check
working-directory: bindings/python
run: uv run ruff check python/goosefs tests examples
- name: ruff format --check
working-directory: bindings/python
run: uv run ruff format --check python/goosefs tests examples
- name: mypy
working-directory: bindings/python
run: uv run --group test mypy python/goosefs
- name: stubtest
working-directory: bindings/python
run: uv run --group test python -m mypy.stubtest goosefs
build-wheel:
name: wheel (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# windows-latest builds a native win_amd64 wheel (MSVC). manylinux
# zig cross-compile runs only on unix runners — see step condition.
os:
- ubuntu-latest
- macos-14
- windows-latest
python-version:
steps:
- uses: actions/checkout@v7
- name: Setup Rust
uses: ./.github/actions/setup
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Sync deps
shell: bash
working-directory: bindings/python
run: uv sync --all-extras --group dev --group test
# Host-native wheel: fast smoke that the binding links and imports.
# On Windows this produces the win_amd64 wheel used for PyPI releases.
- name: maturin build (native)
shell: bash
working-directory: bindings/python
run: uv run maturin build --release --out dist
- name: Install native wheel + import smoke
shell: bash
working-directory: bindings/python
run: |
uv pip install dist/*.whl
uv run python -c "import goosefs; print(goosefs.__version__ if hasattr(goosefs, '__version__') else 'ok')"
# Same path as scripts/release/python.sh: zig cross-compile manylinux
# wheels (x86_64 + aarch64). Validates release artifacts on both Linux
# and macOS runners without needing a Linux host for the aarch64 wheel.
# Skipped on Windows — manylinux tags are Linux-only; Windows ships the
# native MSVC wheel from the step above.
- name: maturin build (manylinux via zig)
if: runner.os != 'Windows'
shell: bash
working-directory: bindings/python
run: |
set -euo pipefail
mkdir -p dist-manylinux
for triple in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
echo "==> rustup target add ${triple}"
rustup target add "${triple}"
echo "==> maturin --zig ${triple}"
uv run --with ziglang maturin build --release \
--target "${triple}" \
--manylinux 2_28 \
--zig \
--out dist-manylinux
done
echo "==> manylinux wheels"
ls -la dist-manylinux
- name: Upload native wheel
uses: actions/upload-artifact@v7
with:
name: goosefs-wheel-native-${{ matrix.os }}-py${{ matrix.python-version }}
path: bindings/python/dist/*
if-no-files-found: error
- name: Upload manylinux wheels (zig)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v7
with:
name: goosefs-wheel-manylinux-${{ matrix.os }}-py${{ matrix.python-version }}
path: bindings/python/dist-manylinux/*
if-no-files-found: error