-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: distribute future-compatible python wheels #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer / PR
participant CI as GitHub Actions
participant Build as Build (cargo/pyo3)
participant Dist as Wheel/Dist
participant Twine as Twine Check
participant PyPI as (Test/)PyPI
Dev->>CI: push PR / merge
CI->>Build: Setup Python (actions/setup-python@v5)
CI->>Build: Build wheels (cargo + pyo3 with abi3-py39)
Build->>Dist: produce dist/*
CI->>Twine: pipx run twine check dist/*
Twine-->>CI: validation result
alt validation OK
CI->>PyPI: publish (repository-url: test or prod, skip-existing, attestations)
PyPI-->>CI: publish result
else validation fails
CI-->>Dev: fail workflow
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Out-of-scope changes
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
bindings/python/Cargo.toml (2)
20-20
: Optional: add generate-import-lib to ease Windows (cross) builds.Including PyO3’s generate-import-lib avoids needing Python import libs on MSVC/MinGW targets and makes CI/cross builds smoother. Consider:
-pyo3 = { version = "0.26.0", features = ["extension-module", "abi3-py39"] } +pyo3 = { version = "0.26.0", features = ["extension-module", "abi3-py39", "generate-import-lib"] }Refs: PyO3 features docs (abi3, generate-import-lib) and python3-dll-a notes. (pyo3.rs, docs.rs)
20-20
: CI/publishing tip: collapse Python matrix and ensure Windows importlib generation.
- Build one wheel per target/arch (abi3 tag) instead of per Python version.
- On Windows runners, enable generate-import-lib or provision the appropriate pythonXY.lib.
Refs: PyO3 features guide. (pyo3.rs)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
bindings/python/Cargo.toml
(1 hunks)
🔇 Additional comments (2)
bindings/python/Cargo.toml (2)
20-20
: LGTM: abi3-py39 is the right switch to ship forward-compatible wheels.This enables the CPython stable ABI for 3.9+, matching the PR goal.
20-20
: Verify Python bindings and CI packaging
- No direct
pyo3::ffi
or CPython FFI calls detected inbindings/python
(ripgrep found none).- Confirm CI builds exactly one
py3-none-abi3-*
wheel per architecture without a Python-version matrix.
WalkthroughUpdated bindings/python/Cargo.toml to enable PyO3's abi3-py39 feature alongside extension-module, configuring the Python binding to target the CPython stable ABI for Python 3.9+. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Assessment against linked issues
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
bindings/python/Cargo.toml (2)
20-20
: Optional: make ABI3 opt-in/out via a feature alias to ease local dev.If you want flexibility (e.g., nightly/dev builds without ABI3), re-export PyO3 features via a crate feature instead of hardwiring them on the dependency.
Example (showing intent; adjust to your preferences):
[dependencies] pyo3 = { version = "0.26.0" } # no features here [features] # Default to abi3 for releases; allow opting out locally with `--no-default-features` default = ["py-abi3"] py-abi3 = ["pyo3/extension-module", "pyo3/abi3-py39"]
20-20
: Docs/CI follow-ups for ABI policy.Document the new Python support policy (CPython 3.9+) and update release CI to build a single abi3 wheel per target triple (avoid per-Python-version matrices). I can draft a minimal maturin/cibuildwheel matrix if helpful.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
bindings/python/Cargo.toml
(1 hunks)
🔇 Additional comments (1)
bindings/python/Cargo.toml (1)
20-20
: ABI3 enablement looks correct and matches the PR goal.Adding
abi3-py39
alongsideextension-module
is the right switch for a single wheel per arch that works on CPython ≥3.9.Please validate the packaging end-to-end:
- CI builds produce cp39-abi3-tagged wheels for each target (Linux/manylinux, macOS [incl. universal2 if desired], Windows).
- Import/runtime smoke tests pass on CPython 3.9, 3.10, 3.11, 3.12, and 3.13.
- The Rust code doesn’t use CPython-version-specific APIs that are outside the limited API (abi3), especially around error formatting, exceptions, or buffer/protocol slots.
- Windows: confirm the wheel imports without a per-version pythonXY import lib (abi3 import libs should be used automatically by PyO3).
When validating built wheels, there's no need to checkout the repo. And, setup-uv action is not oriented for this behavior (emits useless warning about missing uv.lock file),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/python-packaging.yml (2)
193-193
: Avoid depending on a preinstalled pipx binary.Use Python’s module entry point to reduce flakiness on runners where pipx might not be on PATH.
- run: pipx run twine check dist/* + run: python -m pipx run twine check dist/*
186-194
: Optional: Assert abi3 wheel tags in the Release job.Since the PR’s goal is abi3, add a quick guard to fail if any wheel isn’t tagged abi3.
- uses: actions/download-artifact@v5 with: pattern: wheels-* path: dist merge-multiple: true + - name: Verify wheels are abi3-tagged + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + shell: bash + run: | + set -euo pipefail + bad=$(ls dist/*.whl | awk -F/ '{print $NF}' | grep -v -- '-abi3- || true') + if [[ -n "${bad}" ]]; then + echo "Non-abi3 wheels found:" + echo "${bad}" + exit 1 + fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/python-packaging.yml
(1 hunks)cspell.config.yml
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: linux (ubuntu-latest, armv7)
- GitHub Check: linux (ubuntu-latest, ppc64le)
- GitHub Check: linux (ubuntu-latest, aarch64)
- GitHub Check: linux (ubuntu-latest, x86_64)
- GitHub Check: linux (ubuntu-latest, x86)
- GitHub Check: windows (windows-latest, x64)
- GitHub Check: macos (macos-13, x86_64)
- GitHub Check: macos (macos-14, aarch64)
- GitHub Check: windows (windows-latest, x86)
🔇 Additional comments (2)
cspell.config.yml (1)
73-73
: Add "pipx" to dictionary — looks good.Keeps CI logs clean for the new workflow usage.
.github/workflows/python-packaging.yml (1)
186-190
: Conditional Python setup is appropriate for non-tag runs.Matches the conditional “twine check” step and avoids unnecessary setup on tag releases.
resolves #177
Summary by CodeRabbit
Chores
Style