Skip to content

feat: update PyO3 0.24 -> 0.28.2 for Python 3.14 support#266

Merged
joshuarli merged 2 commits intomainfrom
feat-python314
Mar 17, 2026
Merged

feat: update PyO3 0.24 -> 0.28.2 for Python 3.14 support#266
joshuarli merged 2 commits intomainfrom
feat-python314

Conversation

@joshuarli
Copy link
Copy Markdown
Member

@joshuarli joshuarli commented Mar 17, 2026

noticed we fail to build 3.14 wheels here: https://github.com/getsentry/pypi/actions/runs/23167821965/job/67312251630#step:4:14


  • Update PyO3 from 0.24.0 to 0.28.2 to support Python 3.14 (PyO3 0.24 max was 3.13)
  • Migrate all deprecated PyO3 APIs (with_gil -> attach, downcast -> cast, etc.)

PyO3 0.24 does not support Python 3.14 (max 3.13). Update to 0.28.2
which has full Python 3.14 support. Migrate all deprecated APIs:
- Python::with_gil -> Python::attach
- .downcast() -> .cast(), .downcast_bound() -> .cast_bound()
- Add #[pyclass(from_py_object)] on Clone types
- IntoPyObject<Target=PyTuple> -> PyCallArgs trait bound

Also declare Python 3.11-3.14 support in pyproject.toml classifiers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joshuarli joshuarli requested a review from a team as a code owner March 17, 2026 01:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Update PyO3 0.24 -> 0.28.2 for Python 3.14 support by joshuarli in #266

🤖 This preview updates automatically when you update the PR.

@joshuarli joshuarli changed the title Update PyO3 0.24 -> 0.28.2 for Python 3.14 support feat: update PyO3 0.24 -> 0.28.2 for Python 3.14 support Mar 17, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Stale build dependency creates version mismatch in lockfile
    • Removed the unused pyo3-build-config build-dependency from Cargo.toml and updated Cargo.lock to eliminate the stale 0.24.0 entry so only the pyo3-aligned version remains.

Create PR

Or push these changes by commenting:

@cursor push 9203dec2af
Preview (9203dec2af)
diff --git a/sentry_streams/Cargo.lock b/sentry_streams/Cargo.lock
--- a/sentry_streams/Cargo.lock
+++ b/sentry_streams/Cargo.lock
@@ -1299,23 +1299,13 @@
  "libc",
  "once_cell",
  "portable-atomic",
- "pyo3-build-config 0.28.2",
+ "pyo3-build-config",
  "pyo3-ffi",
  "pyo3-macros",
 ]
 
 [[package]]
 name = "pyo3-build-config"
-version = "0.24.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9b6c2b34cf71427ea37c7001aefbaeb85886a074795e35f161f5aecc7620a7a"
-dependencies = [
- "once_cell",
- "target-lexicon",
-]
-
-[[package]]
-name = "pyo3-build-config"
 version = "0.28.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
@@ -1330,7 +1320,7 @@
 checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
 dependencies = [
  "libc",
- "pyo3-build-config 0.28.2",
+ "pyo3-build-config",
 ]
 
 [[package]]
@@ -1353,7 +1343,7 @@
 dependencies = [
  "heck",
  "proc-macro2",
- "pyo3-build-config 0.28.2",
+ "pyo3-build-config",
  "quote",
  "syn",
 ]
@@ -1589,7 +1579,6 @@
  "metrics-exporter-dogstatsd",
  "parking_lot",
  "pyo3",
- "pyo3-build-config 0.24.0",
  "rand 0.8.5",
  "rdkafka",
  "reqwest",

diff --git a/sentry_streams/Cargo.toml b/sentry_streams/Cargo.toml
--- a/sentry_streams/Cargo.toml
+++ b/sentry_streams/Cargo.toml
@@ -39,9 +39,6 @@
 parking_lot = "0.12.1"
 pyo3 = { version = "*", features = ["auto-initialize"] }
 
-[build-dependencies]
-pyo3-build-config = "*"
-
 # For now (while we are still rolling out streams to SBC), let's enable maximal
 # debug information. There should only be overhead in space and when many
 # stacktraces are generated (thousands/sec)

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread sentry_streams/Cargo.lock Outdated
- py.allow_threads() was renamed to py.detach() in PyO3 0.28
- Remove unused pyo3-build-config build dependency (no build.rs exists)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joshuarli joshuarli merged commit fe885cc into main Mar 17, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants