Skip to content

Conversation

@winstxnhdw
Copy link
Contributor

@winstxnhdw winstxnhdw commented Nov 15, 2025

This PR uses the latest pyo3 API and bumps all dependencies. Instead of using abi3-py38 we will use pyo3-build-config for better cross-version compatibility.

Summary by Sourcery

Migrate the crate to Rust 2024 and the latest pyo3 API by upgrading dependencies, adding build configuration, and updating module and function signatures.

Enhancements:

  • adjust lib.rs to use the latest pyo3 API by importing PyAny, changing return types to Py, and updating #[pymodule] signatures

Build:

  • bump crate edition to 2024
  • add pyo3-build-config build-dependency and new build.rs to enable pyo3 cfgs
  • upgrade dependencies (lazy_static, pyo3, pythonize, regex, rustc-hash, serde_json, etc.) to latest versions

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 15, 2025

Reviewer's Guide

This PR upgrades the crate to the latest pyo3 API by bumping the Rust edition and all dependencies, adding a build script for pyo3 configurations, and refactoring the library code to align with the new pyo3 interface.

Class diagram for updated PyO3 integration in lib.rs

classDiagram
    class fast_query_parsers {
        +parse_query_string(qs: &[u8], separator: char) PyResult<Vec<(String, String)>>
        +parse_url_encoded_dict(py: Python, qs: &[u8], parse_numbers: bool) PyResult<Py<PyAny>>
    }
    class PyModule
    class Bound
    class PyAny
    class Py
    fast_query_parsers --> "1" Bound : uses
    fast_query_parsers --> "1" PyModule : uses
    fast_query_parsers --> "1" PyAny : returns
    fast_query_parsers --> "1" Py : returns
Loading

File-Level Changes

Change Details Files
Update Rust edition, bump dependencies, and integrate pyo3 build-config
  • changed Rust edition from 2021 to 2024
  • bumped all dependencies (lazy_static, pyo3, pythonize, regex, rustc-hash, serde_json, urlencoding) to latest versions
  • added pyo3-build-config under build-dependencies
  • introduced build.rs to invoke pyo3_build_config::use_pyo3_cfgs()
Cargo.toml
Cargo.lock
src/build.rs
Refactor library code to match new pyo3 API
  • import PyAny and adjust parse_url_encoded_dict return type to Py
  • wrap pythonize output with unwrap().into()
  • update #[pymodule] signature to use Bound<'_, PyModule> without an explicit Python parameter
src/lib.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Move your build script out of src/ and into the crate root as Cargo only picks up build.rs at the project root, so pyo3_build_config won’t be applied otherwise.
  • Instead of unwrapping the result of pythonize in parse_url_encoded_dict, propagate the error with ? to avoid panics at runtime.
  • Verify that the new #[pymodule] signature using Bound<'_, PyModule> is valid in pyo3 0.26 (and that Bound is imported); consider reverting to the documented fn fast_query_parsers(_py: Python, m: &PyModule) -> PyResult<()> form if needed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Move your build script out of src/ and into the crate root as Cargo only picks up build.rs at the project root, so pyo3_build_config won’t be applied otherwise.
- Instead of unwrapping the result of pythonize in parse_url_encoded_dict, propagate the error with ? to avoid panics at runtime.
- Verify that the new #[pymodule] signature using Bound<'_, PyModule> is valid in pyo3 0.26 (and that Bound is imported); consider reverting to the documented fn fast_query_parsers(_py: Python, m: &PyModule) -> PyResult<()> form if needed.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant