Build Python 3.14 free-threaded wheels#36
Merged
Conversation
Reviewer's GuideUpdates the Rust extension to be compatible with the latest PyO3 and Python 3.14 free-threaded builds, adjusts the Python/Rust APIs accordingly, and extends CI and publishing workflows to build and test against the new interpreter variants with improved parallel test execution. Class diagram for updated Rust PyO3 extension APIclassDiagram
class FastQueryParsersModule {
+gil_used : bool
+fast_query_parsers(_py : Python, m : Bound_PyModule) PyResult_unit
+parse_query_string(qs : slice_u8, separator : char) PyResult_Vec_String_String
+parse_url_encoded_dict(py : Python, qs : slice_u8, parse_numbers : bool) PyResult_Py_PyAny
}
class PyO3 {
+version : 0_27_2
+features : extension_module, abi3_py38
}
class Pythonize {
+version : 0_27_0
}
FastQueryParsersModule --> PyO3 : uses
FastQueryParsersModule --> Pythonize : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
edgarrmondragon
commented
Jan 4, 2026
edgarrmondragon
marked this pull request as ready for review
January 4, 2026 06:59
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
parse_url_encoded_dict, thepythonize(...).unwrap()introduces a potential panic path; consider propagating the error as aPyErr(e.g., via?or explicit mapping) instead of unwrapping. - The CI step
uv run pytest --parallel-threads=10hardcodes the parallelism level and may oversubscribe smaller runners; consider using an auto-detection mode or deriving the thread count from available CPUs or a workflow input. - In
publish.yaml,PYTHON_VERSION: "3.8 3.14t"sets a single space-separated string; if this is meant to represent multiple versions for consumers of the env var, consider encoding it in a more structured way (e.g., a matrix, a comma-separated list, or separate variables) to avoid parsing ambiguity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `parse_url_encoded_dict`, the `pythonize(...).unwrap()` introduces a potential panic path; consider propagating the error as a `PyErr` (e.g., via `?` or explicit mapping) instead of unwrapping.
- The CI step `uv run pytest --parallel-threads=10` hardcodes the parallelism level and may oversubscribe smaller runners; consider using an auto-detection mode or deriving the thread count from available CPUs or a workflow input.
- In `publish.yaml`, `PYTHON_VERSION: "3.8 3.14t"` sets a single space-separated string; if this is meant to represent multiple versions for consumers of the env var, consider encoding it in a more structured way (e.g., a matrix, a comma-separated list, or separate variables) to avoid parsing ambiguity.
## Individual Comments
### Comment 1
<location> `src/lib.rs:20-21` </location>
<code_context>
- Ok(pythonize(py, &parse_query_string_to_json(qs, parse_numbers)).unwrap())
+fn parse_url_encoded_dict(py: Python, qs: &[u8], parse_numbers: bool) -> PyResult<Py<PyAny>> {
+ Ok(
+ pythonize(py, &parse_query_string_to_json(qs, parse_numbers))
+ .unwrap()
+ .into(),
+ )
</code_context>
<issue_to_address>
**issue (bug_risk):** Avoid panicking on pythonize() failure and propagate a proper Python exception instead.
Because this is called from Python, `unwrap()` will abort the process if `pythonize()` fails (e.g., on unexpected input). Since the function already returns `PyResult`, please propagate the error instead, for example:
```rust
pythonize(py, &parse_query_string_to_json(qs, parse_numbers))
.map(|obj: Py<PyAny>| obj.into())
```
or:
```rust
pythonize(py, &parse_query_string_to_json(qs, parse_numbers))
.map(Py::from)
```
This ensures failures become Python exceptions rather than panics.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This was referenced Jan 4, 2026
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
edgarrmondragon
force-pushed
the
pyo3-0.27
branch
from
February 15, 2026 04:06
0cbb321 to
c91ce04
Compare
Contributor
Author
|
@winstxnhdw would you mind taking a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Build Python 3.14 free-threaded wheels.
From Quansight Labs' Free-Threading Guide:
I also took the opportunity to bump PyO3 to 0.27 and migrate the project to the latest API.Closes
NA
Summary by Sourcery
Add support for Python 3.14 free-threaded builds and update the Rust/PyO3 bindings accordingly.
New Features:
Enhancements:
CI:
Deployment: