Skip to content

Commit ba96b2f

Browse files
authored
fix: python publishing pipeline (#2898)
1. Stop running pytest an additional time after building the wheel. As far as I can tell it triggers another build which is the actual code it runs. Instead we just run `pytest` in an isolated env in CI. 2. Explicitly configure the linux compatibility we want to target. 3. Try and make better use of uv's isolation capabilities to get more predictable outcomes with steps that don't depend on the results or state generated by previous steps. Some of the issues we've had are caused by a surprising behavior by uv/maturin/pep517 that might be a bug, I've filed an issue with maturin and hopefully I'll be able to make some progress with them.
1 parent 271e49a commit ba96b2f

File tree

7 files changed

+55
-58
lines changed

7 files changed

+55
-58
lines changed

.github/workflows/bench-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
echo '<details>' >> comment.md
9898
echo '<summary>Table of Results</summary>' >> comment.md
9999
echo '' >> comment.md
100-
uv run scripts/compare-benchmark-jsons.py base.json ${{ matrix.benchmark.id }}.json \
100+
uv run --no-project scripts/compare-benchmark-jsons.py base.json ${{ matrix.benchmark.id }}.json \
101101
>> comment.md
102102
echo '</details>' >> comment.md
103103

.github/workflows/ci.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ jobs:
4848
- uses: actions/checkout@v4
4949
with:
5050
submodules: "recursive"
51-
- uses: spiraldb/actions/.github/actions/[email protected]
51+
- name: Install uv
52+
uses: spiraldb/actions/.github/actions/[email protected]
53+
with:
54+
sync: false
5255
- name: Python Lint - Format
5356
run: uv run ruff format --check .
5457
- name: Python Lint - Ruff
@@ -57,56 +60,64 @@ jobs:
5760
python-test:
5861
name: "Python (test)"
5962
runs-on: ubuntu-latest
63+
env:
64+
RUST_LOG: "info,uv=debug"
6065
steps:
6166
- uses: actions/checkout@v4
6267
with:
6368
submodules: "recursive"
6469
- uses: ./.github/actions/cleanup
6570
- uses: rui314/setup-mold@v1
6671
- uses: ./.github/actions/setup-rust
67-
- uses: spiraldb/actions/.github/actions/[email protected]
72+
- name: Install uv
73+
uses: spiraldb/actions/.github/actions/[email protected]
74+
with:
75+
sync: false
6876

6977
# Ensure the stub files are up-to-date with the public API of the native module.
7078
- name: Stubtest - PyVortex
7179
run: |
72-
uv run stubtest vortex._lib --allowlist python/vortex/_lib/mypy.allowlist
80+
uv run --isolated --all-packages stubtest vortex._lib --allowlist python/vortex/_lib/mypy.allowlist
7381
working-directory: pyvortex/
7482

7583
- name: Pytest - PyVortex
7684
run: |
77-
uv run pytest --benchmark-disable test/
85+
uv run --isolated --all-packages pytest --benchmark-disable test/
7886
working-directory: pyvortex/
7987

8088
- name: Doctest - PyVortex
8189
run: |
82-
uv run make clean && uv run make doctest
90+
uv run --isolated --all-packages make doctest
8391
working-directory: docs/
8492

8593
- name: Ensure docs build - PyVortex
8694
run: |
87-
uv run make html
95+
uv run --isolated --all-packages make html
8896
working-directory: docs/
8997

98+
- uses: mlugg/setup-zig@v1
9099
- name: Ensure wheel and sdist can be built on Linux - PyVortex
100+
shell: bash
91101
run: |
92-
# force linux compatibility to ensure there is exactly one wheel ergo no ambiguity in installation
93-
uv run maturin build --interpreter python3.10 --compatibility linux
102+
echo "Clearing wheel target directory"
103+
rm -rf ../target/wheels/
104+
105+
uv venv
106+
uv pip install "maturin[zig]"
107+
uv tool run maturin build --interpreter python3.10 --zig
108+
uv tool run maturin build --interpreter python3.10 --zig --sdist
109+
110+
file_count=$(ls -1 ../target/wheels/ | wc -l)
111+
112+
if [[ $file_count -ne 2 ]]; then
113+
echo "Unexpected number of files detected ${file_count}:"
114+
ls ../target/wheels/
115+
exit 1
116+
else
117+
echo "Generated two files"
118+
fi
94119
working-directory: pyvortex/
95120

96-
- name: Ensure wheel can run tests successfully
97-
run: |
98-
set -ex
99-
100-
echo creating a fresh venv which does *not* have the normal dependencies to ensure the wheel dependencies are correct
101-
102-
rm -rf .venv
103-
uv sync --only-dev
104-
105-
uv run pip install target/wheels/vortex_array-*.whl || { uv run pip debug --verbose ; exit 1 ; }
106-
uv run pip install pytest
107-
cd pyvortex/test
108-
uv run pytest
109-
110121
rust-docs:
111122
name: "Rust (docs)"
112123
runs-on:

.github/workflows/docs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ jobs:
2020
submodules: "recursive"
2121
- uses: ./.github/actions/cleanup
2222
- uses: ./.github/actions/setup-rust
23-
- uses: spiraldb/actions/.github/actions/[email protected]
24-
23+
- name: Install uv
24+
uses: spiraldb/actions/.github/actions/[email protected]
25+
with:
26+
sync: false
2527
- name: build Python and Rust docs
2628
run: |
27-
uv run make -C docs html
29+
uv run --all-packages make -C docs html
2830
- name: Upload static files as artifact
2931
id: deployment
3032
uses: actions/upload-pages-artifact@v3

.github/workflows/release-plz.yml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,31 +75,20 @@ jobs:
7575
rust-toolchain: ${{ steps.rust-toolchain.version }}
7676
working-directory: pyvortex
7777
target: x86_64
78-
args: --release --interpreter python3.10 --sdist
78+
command: build
79+
args: --release --interpreter python3.10 --auditwheel check --sdist
7980
- name: Build wheels - aarch64
8081
uses: PyO3/maturin-action@v1
8182
with:
8283
rust-toolchain: ${{ steps.rust-toolchain.version }}
8384
working-directory: pyvortex
8485
target: aarch64 # NB: aarch64 becomes arm64 in the wheel's platform tag.
85-
args: --release --interpreter python3.10
86+
command: build
87+
args: --release --interpreter python3.10 --auditwheel check
8688
- name: Install UV
8789
uses: spiraldb/actions/.github/actions/[email protected]
8890
with:
8991
sync: false
90-
- name: test wheel
91-
run: |
92-
set -ex
93-
94-
ls -al target/wheels
95-
96-
echo removing linux_x86_64 if it exists because PyPI will reject the package if it is present
97-
rm -f target/wheels/*linux_x86_64.whl
98-
99-
uv run pip install --no-deps --force-reinstall vortex-array --no-index --find-links target/wheels
100-
101-
cd pyvortex/test
102-
uv run pytest
10392
- name: Upload wheels
10493
uses: actions/upload-artifact@v4
10594
with:
@@ -128,20 +117,8 @@ jobs:
128117
working-directory: pyvortex
129118
target: x86_64
130119
manylinux: auto
131-
args: --release --interpreter python3.10
132-
- name: test wheel
133-
run: |
134-
set -ex
135-
136-
ls -al target/wheels
137-
138-
echo removing linux_x86_64 if it exists because PyPI will reject the package if it is present
139-
rm -f target/wheels/*linux_x86_64.whl
140-
141-
uv run pip install --no-deps --force-reinstall vortex-array --no-index --find-links target/wheels
142-
143-
cd pyvortex/test
144-
uv run pytest
120+
command: build
121+
args: --release --interpreter python3.10 --auditwheel check --zig
145122
- name: Upload wheels
146123
uses: actions/upload-artifact@v4
147124
with:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/vortex-array)](https://pypi.org/project/vortex-array/)
77

88
> \[!TIP\]
9-
> Check out our [Docs](https://docs.vortex.dev/) and per-commit [Benchmarks](https://bench.vortex.dev)
9+
> Check out our [Docs](https://docs.vortex.dev/) and per-commit [Benchmarks](https://bench.vortex.dev)
1010
1111
Vortex is an extensible, state-of-the-art columnar file format, with associated tools for working with compressed Apache
1212
Arrow arrays in-memory, on-disk, and over-the-wire.
@@ -245,7 +245,7 @@ This repo uses uv to manage the combined Rust/Python monorepo build. After insta
245245

246246
```bash
247247
# Install uv from https://docs.astral.sh/uv/getting-started/installation/
248-
uv sync
248+
uv sync --all-packages
249249
```
250250

251251
## License

pyvortex/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ requires-python = ">= 3.10"
1111
polars = ["polars>=1.24.0"]
1212
pandas = ["pandas>=2.2.0"]
1313
numpy = ["numpy>=1.26.0"]
14+
duckdb = ["duckdb>=1.1.2"]
1415

1516
[project.urls]
1617
Documentation = "https://docs.vortex.dev"
@@ -29,12 +30,14 @@ managed = true
2930
python-source = "python"
3031
module-name = "vortex._lib"
3132
features = ["pyo3/extension-module"]
33+
compatibility = "manylinux2014"
3234
include = [
3335
{ path = "rust-toolchain.toml", format = "sdist" },
3436
{ path = "README.md", format = "sdist" },
3537
{ path = "python/vortex/py.typed", format = "sdist" },
3638
]
3739

40+
3841
[dependency-groups]
3942
dev = [
4043
"mypy>=1.14.1",

uv.lock

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)