Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/uv-constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# see https://github.com/kislyuk/argcomplete/issues/559
argcomplete<3.7.1; python_version < "3.10"
3 changes: 2 additions & 1 deletion .github/workflows/benches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ concurrency:
cancel-in-progress: true

env:
UV_CONSTRAINT: ${{ github.workspace }}/.github/uv-constraints.txt
UV_PYTHON: "3.14t"

jobs:
Expand Down Expand Up @@ -46,7 +47,7 @@ jobs:
tool: cargo-codspeed

- name: Run the benchmarks
uses: CodSpeedHQ/action@v4
uses: CodSpeedHQ/action@v5.0.1
with:
run: uvx nox -s codspeed
token: ${{ secrets.CODSPEED_TOKEN }}
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:

env:
NOX_DEFAULT_VENV_BACKEND: uv
UV_CONSTRAINT: ${{ github.workspace }}/.github/uv-constraints.txt

jobs:
build:
Expand All @@ -42,24 +43,28 @@ jobs:
# installs using setup-python do not work for arm macOS 3.9 and below
- if: ${{ !(inputs.os == 'macos-latest' && contains(fromJSON('["3.8", "3.9"]'), inputs.python-version) && inputs.python-architecture == 'x64') }}
name: Set up Python ${{ inputs.python-version }}
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
architecture: ${{ inputs.python-architecture }}
# PyPy can have FFI changes within Python versions, which creates pain in CI
check-latest: ${{ startsWith(inputs.python-version, 'pypy') }}

# workaround for the above, only available for 3.9
- if: ${{ inputs.os == 'macos-latest' && contains(fromJSON('["3.9"]'), inputs.python-version) && inputs.python-architecture == 'x64' }}
name: Set up Python ${{ inputs.python-version }}
- name: Install zoneinfo backport for Python 3.8
id: zoneinfo-backport
if: inputs.python-version == '3.8'
run: |
python -m pip install backports.zoneinfo
python -c "import os, site; open(os.environ['GITHUB_OUTPUT'], 'a').write(f'pythonpath={site.getsitepackages()[0]}\n')"

- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: cpython-${{ inputs.python-version }}-macos-x86-64
# workaround for the above, only available for 3.9
python-version: ${{ inputs.os == 'macos-latest' && contains(fromJSON('["3.9"]'), inputs.python-version) && inputs.python-architecture == 'x64' && format('cpython-{0}-macos-x86-64', inputs.python-version) || '' }}
save-cache: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}

- name: Install nox
run: python -m pip install --upgrade pip && pip install nox[uv]

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -77,10 +82,6 @@ jobs:
run: |
echo "CARGO_BUILD_TARGET=i686-pc-windows-msvc" >> $GITHUB_ENV

- name: Install zoneinfo backport for Python 3.8
if: contains(fromJSON('["3.8"]'), inputs.python-version)
run: python -m pip install backports.zoneinfo

- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
Expand All @@ -91,7 +92,7 @@ jobs:

- if: inputs.rust == inputs.MSRV
name: Prepare MSRV package versions
run: nox -s set-msrv-package-versions
run: uvx nox -s set-msrv-package-versions

- if: inputs.rust != 'stable'
name: Ignore changed error messages for ui tests (still run for coverage)
Expand All @@ -113,20 +114,23 @@ jobs:
- name: Run pyo3-ffi-check
# TODO: investigate graalpy failures
if: ${{ endsWith(inputs.python-version, '-dev') || (steps.ffi-changes.outputs.changed == 'true' && inputs.rust == 'stable' && !startsWith(inputs.python-version, 'graalpy')) }}
run: nox -s ffi-check
run: uvx nox -s ffi-check

- uses: ./.github/actions/prepare-coverage
if: ${{ inputs.os != 'windows-11-arm' }} # https://github.com/rust-lang/rust/issues/150123

- name: Build docs
run: nox -s docs
run: uvx nox -s docs

- name: Run Rust tests
run: nox -s test-rust
run: uvx nox -s test-rust
env:
PYO3_PYTHON: ${{ steps.setup-python.outputs.python-path || 'python' }}
PYTHONPATH: ${{ steps.zoneinfo-backport.outputs.pythonpath }}

- name: Test python examples and tests
shell: bash
run: nox -s test-py
run: uvx nox -s test-py
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.14'
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s check-changelog
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s check-changelog
43 changes: 22 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:
env:
CARGO_TERM_COLOR: always
NOX_DEFAULT_VENV_BACKEND: uv
UV_CONSTRAINT: ${{ github.workspace }}/.github/uv-constraints.txt
UV_PYTHON: 3.14

jobs:
Expand All @@ -23,20 +24,20 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: python -m pip install --upgrade pip && pip install nox[uv]
- uses: astral-sh/setup-uv@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check python formatting and lints (ruff)
run: nox -s ruff
run: uvx nox -s ruff
- name: Check rust formatting (rustfmt)
run: nox -s rustfmt
run: uvx nox -s rustfmt
- name: Check markdown formatting (rumdl)
run: nox -s rumdl
run: uvx nox -s rumdl
- name: Check `required-features` in Cargo.toml
run: nox -s check-test-features
run: uvx nox -s check-test-features
- name: Spell check
run: nox -s typos
run: uvx nox -s typos

resolve:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -95,12 +96,12 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
- run: python -m pip install --upgrade pip && pip install nox[uv]
- uses: astral-sh/setup-uv@v7
# This is a smoke test to confirm that CI will run on MSRV (including dev dependencies)
- name: Check with MSRV package versions
run: |
nox -s set-msrv-package-versions
nox -s check-all
uvx nox -s set-msrv-package-versions
uvx nox -s check-all

env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -447,8 +448,8 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@valgrind
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s test-rust -- release skip-full
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s test-rust -- release skip-full
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: valgrind --leak-check=no --error-exitcode=1
RUST_BACKTRACE: 1
Expand All @@ -470,8 +471,8 @@ jobs:
with:
components: rust-src
- uses: taiki-e/install-action@cargo-careful
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s test-rust -- careful skip-full
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s test-rust -- careful skip-full
env:
RUST_BACKTRACE: 1
UI_TEST: skip
Expand Down Expand Up @@ -661,8 +662,8 @@ jobs:
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack,cargo-minimal-versions
- run: python3 -m pip install --upgrade pip && pip install nox[uv]
- run: python3 -m nox -s check-feature-powerset -- ${{ matrix.rust != 'stable' && 'minimal-versions' || '' }}
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s check-feature-powerset -- ${{ matrix.rust != 'stable' && 'minimal-versions' || '' }}

test-cross-compilation:
needs: [fmt, resolve]
Expand Down Expand Up @@ -816,8 +817,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'CI-save-pr-cache') }}
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s test-introspection
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s test-introspection
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}

Expand All @@ -831,8 +832,8 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s test-introspection
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s test-introspection

pytests-type-checking:
needs: [fmt]
Expand All @@ -850,8 +851,8 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- run: python -m pip install --upgrade pip && pip install nox[uv]
- run: nox -s ${{matrix.checker}}
- uses: astral-sh/setup-uv@v7
- run: uvx nox -s ${{matrix.checker}}
working-directory: pytests

conclusion:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/netlify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- uses: astral-sh/setup-uv@v7

- uses: dtolnay/rust-toolchain@nightly

Expand All @@ -47,9 +48,7 @@ jobs:

# This builds the book in target/guide/.
- name: Build the guide
run: |
python -m pip install --upgrade pip && pip install nox[uv]
nox -s ${{ github.event_name == 'release' && 'build-guide' || 'check-guide' }}
run: uvx nox -s ${{ github.event_name == 'release' && 'build-guide' || 'check-guide' }}
env:
PYO3_VERSION_TAG: ${{ github.event_name == 'release' && steps.prepare_tag.outputs.tag_name || 'main' }}
# allows lychee to get better rate limits from github
Expand Down Expand Up @@ -79,9 +78,7 @@ jobs:
echo "PYO3_VERSION=${PYO3_VERSION}" >> $GITHUB_ENV

- name: Build the site
run: |
python -m pip install --upgrade pip && pip install nox[uv] towncrier requests
nox -s build-netlify-site -- ${{ (github.ref != 'refs/heads/main' && '--preview') || '' }}
run: uvx --with requests nox -s build-netlify-site -- ${{ (github.ref != 'refs/heads/main' && '--preview') || '' }}

# Upload the built site as an artifact for deploy workflow to consume
- name: Upload Build Artifact
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
version:
description: The version to build

env:
UV_CONSTRAINT: ${{ github.workspace }}/.github/uv-constraints.txt

jobs:
release:
permissions:
Expand Down
1 change: 1 addition & 0 deletions Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Some of the functionality of `pyo3-build-config`:
cfg with the target DLL name, and the `extern_libpython!` macro expands to the appropriate
`#[link(name = "...", kind = "raw-dylib")]` attribute. This enables cross compiling Python
extensions for Windows without having to install any Windows Python libraries.
This can be opted out by setting `PYO3_USE_RAW_DYLIB` to anything other than "1".

<!-- External Links -->

Expand Down
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h

<!-- towncrier release notes start -->

## [0.29.2] - 2026-08-05

### Packaging

- Add `PYO3_USE_RAW_DYLIB=0` opt-out of `raw-dylib` linking for Windows. [#6185](https://github.com/PyO3/pyo3/pull/6185)

### Fixed

- Fix PyO3 0.29 regression with failure to link under Cygwin / MSYS2. [#6185](https://github.com/PyO3/pyo3/pull/6185)
- Fix stubs generation for field getters (`#[pyo3(get)]`) when `IntoPyObject` is only implemented on references of the field type. [#6276](https://github.com/PyO3/pyo3/pull/6276)
- Fix `#[classmethod]` magic methods receiving the instance instead of its type when invoked through a type slot. [#6283](https://github.com/PyO3/pyo3/pull/6283)
- Fix `pyo3_build_config::add_libpython_rpath_link_args` emitting Unix-style rpath linker arguments on Windows and Cygwin. [#6284](https://github.com/PyO3/pyo3/pull/6284)
- Fix PyO3 0.29.1 regression on PyPy causing crashes when deallocating `#[pyclass]` instances. [#6294](https://github.com/PyO3/pyo3/pull/6294)
- Fix missing trailing nul in Python 3.9 `#[pyclass]` docstrings. [#6296](https://github.com/PyO3/pyo3/pull/6296)
- Fix reference count leak of `#[classattr]` values created from `fn` items. [#6297](https://github.com/PyO3/pyo3/pull/6297)

## [0.29.1] - 2026-08-02

### Changed
Expand Down Expand Up @@ -2682,7 +2698,8 @@ Yanked

- Initial release

[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.29.1...HEAD
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.29.2...HEAD
[0.29.1]: https://github.com/pyo3/pyo3/compare/v0.29.1...v0.29.2
[0.29.1]: https://github.com/pyo3/pyo3/compare/v0.29.0...v0.29.1
[0.29.0]: https://github.com/pyo3/pyo3/compare/v0.28.3...v0.29.0
[0.28.3]: https://github.com/pyo3/pyo3/compare/v0.28.2...v0.28.3
Expand Down
20 changes: 15 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.29.1"
version = "0.29.2"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand Down Expand Up @@ -36,10 +36,10 @@ libc = "0.2.62"
once_cell = "1.21"

# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.29.1" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.29.2" }

# support crate for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.29.1", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.29.2", optional = true }

# support crate for multiple-pymethods feature
inventory = { version = "0.3.5", optional = true }
Expand Down Expand Up @@ -94,7 +94,7 @@ regex = "1.12.3"
ctrlc = "3.5.2"

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "=0.29.1" }
pyo3-build-config = { path = "pyo3-build-config", version = "=0.29.2" }

[features]
default = ["macros"]
Expand Down Expand Up @@ -237,7 +237,17 @@ unsafe_op_in_unsafe_fn = "warn"
level = "warn"
check-cfg = [
'cfg(pyo3_disable_reference_pool)',
'cfg(pyo3_leak_on_drop_without_reference_pool)'
'cfg(pyo3_leak_on_drop_without_reference_pool)',
'cfg(pyo3_use_raw_dylib)',
# this horrible hard-coded list should be kept in sync with the list of possible
# cfgs in pyo3-ffi/src/impl_/macros.rs
#
# for library names outside of this set we don't support raw-dylib and require a
# proper import library
#
# maybe in the future this list will not be necessary, see
# internals.rust-lang.org/t/support-renames-with-link-name-kind-raw-dylib/24415
'cfg(pyo3_dll, values("python3", "python3_d", "python3t", "python3t_d", "python38", "python38_d", "python39", "python39_d", "python310", "python310_d", "python311", "python311_d", "python312", "python312_d", "python313", "python313_d", "python313t", "python313t_d", "python314", "python314_d", "python314t", "python314t_d", "python315", "python315_d", "python315t", "python315t_d", "python316", "python316_d", "python316t", "python316t_d", "libpypy3.11-c"))',
]


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ name = "string_sum"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.29.1"
pyo3 = "0.29.2"
```

**`src/lib.rs`**
Expand Down Expand Up @@ -139,7 +139,7 @@ Start a new project with `cargo new` and add `pyo3` to the `Cargo.toml` like th

```toml
[dependencies.pyo3]
version = "0.29.1"
version = "0.29.2"
# Enabling this cargo feature will cause PyO3 to start a Python interpreter on first call to `Python::attach`
features = ["auto-initialize"]
```
Expand Down
2 changes: 1 addition & 1 deletion examples/decorator/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.29.1");
variable::set("PYO3_VERSION", "0.29.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
2 changes: 1 addition & 1 deletion examples/maturin-starter/.template/pre-script.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable::set("PYO3_VERSION", "0.29.1");
variable::set("PYO3_VERSION", "0.29.2");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/pyproject.toml", "pyproject.toml");
file::delete(".template");
Loading
Loading