Skip to content

fix: track Cython inputs for editable pixi-build-python builds - #6123

Merged
baszalmstra merged 1 commit into
prefix-dev:mainfrom
kkraus14:codex/pixi-build-python-cython-inputs
May 15, 2026
Merged

baszalmstra merged 1 commit into
prefix-dev:mainfrom
kkraus14:codex/pixi-build-python-cython-inputs

Conversation

@kkraus14

@kkraus14 kkraus14 commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Track Cython inputs for editable pixi-build-python builds

Generated by Codex.

Summary

  • keep pure Python sources excluded from editable pixi-build-python input globs
  • include Cython inputs (.pyx, .pxd, .pxi) only when Cython is declared in the model dependencies or build-system.requires
  • use those Cython inputs to invalidate the source artifact cache when compiled editable builds change
  • update input-glob snapshots

Fixes #6122.

Tests

pixi run -e rust-test insta test -p pixi-build-python --accept -- input_globs
pixi run -e rust-test insta test -p pixi-build-python --check -- input_globs
pixi run -e rust-test cargo build -p pixi-build-python

Manual reproducer check:

Comment thread crates/pixi_build_python/src/main.rs Outdated
};
// Cython inputs affect compiled extension artifacts even when the
// Python package itself is installed editable.
let cython_globs = Vec::from(["**/*.{pyx,pxd,pxi}"]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also happy to just add these into the existing python_globs if you feel it's more appropriate

@kkraus14 kkraus14 changed the title Track Cython inputs for editable pixi-build-python builds (generated by Codex) fix: Track Cython inputs for editable pixi-build-python builds (generated by Codex) May 14, 2026

@baszalmstra baszalmstra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add these only if cython is a dependency? Tracking globs has an overhead, seems wasteful to always add these if they will not match anyway.

@kkraus14
kkraus14 force-pushed the codex/pixi-build-python-cython-inputs branch from 269a68f to 2397f6b Compare May 14, 2026 05:44
@kkraus14

kkraus14 commented May 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the review comment: Cython input globs are now added only when Cython is present in the model dependencies or in build-system.requires.

I also added tests for explicit model dependency, pyproject build-system dependency, and the no-Cython case.

Generated by Codex.

@kkraus14

kkraus14 commented May 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Would it be possible to add these only if cython is a dependency? Tracking globs has an overhead, seems wasteful to always add these if they will not match anyway.

We were previously always tracking .pyx Cython files where this PR adds tracking .pxd and .pxi files as well, but happy to move all of them to only be tracked in the case of Cython being a dependency. This would be a change in behavior if someone is doing something funky where they're getting Cython outside of pixi's dependency system.

@kkraus14
kkraus14 force-pushed the codex/pixi-build-python-cython-inputs branch from 2397f6b to 38fed41 Compare May 14, 2026 14:20
@baszalmstra baszalmstra changed the title fix: Track Cython inputs for editable pixi-build-python builds (generated by Codex) fix: track Cython inputs for editable pixi-build-python builds May 15, 2026
@baszalmstra
baszalmstra merged commit 3314609 into prefix-dev:main May 15, 2026
37 checks passed
kkraus14 pushed a commit to NVIDIA/cuda-python that referenced this pull request Jul 21, 2026
Pixi <0.71.0 re-ran the editable source build on every `pixi run`,
recompiling all ~29 Cython extensions in cuda_bindings (~27s) even when
nothing changed, because setuptools' editable_wheel uses fresh temp
build dirs so build_ext always sees the .so as older than its source.

Pixi 0.71.0 fixed this upstream with a content-addressed source-build
cache (prefix-dev/pixi#6285) plus separate Cython input tracking
(prefix-dev/pixi#6123). Locally verified: under 0.66 the 2nd no-op run
rebuilds 29 extensions with a fresh /tmp/*.build-temp; under 0.73 it
rebuilds nothing and returns instantly.

The fix also bumps the pixi.lock format from v6 to v7 (unreadable by
pixi 0.66), so this requires all contributors to move to pixi >=0.71.
Regenerated all six committed lock files to v7 accordingly.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
clin1234 pushed a commit to clin1234/cuda-python that referenced this pull request Jul 30, 2026
…VIDIA#2396)

Pixi <0.71.0 re-ran the editable source build on every `pixi run`,
recompiling all ~29 Cython extensions in cuda_bindings (~27s) even when
nothing changed, because setuptools' editable_wheel uses fresh temp
build dirs so build_ext always sees the .so as older than its source.

Pixi 0.71.0 fixed this upstream with a content-addressed source-build
cache (prefix-dev/pixi#6285) plus separate Cython input tracking
(prefix-dev/pixi#6123). Locally verified: under 0.66 the 2nd no-op run
rebuilds 29 extensions with a fresh /tmp/*.build-temp; under 0.73 it
rebuilds nothing and returns instantly.

The fix also bumps the pixi.lock format from v6 to v7 (unreadable by
pixi 0.66), so this requires all contributors to move to pixi >=0.71.
Regenerated all six committed lock files to v7 accordingly.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editable pixi-build-python Cython source package is not rebuilt after Cython input changes

2 participants