-
-
Notifications
You must be signed in to change notification settings - Fork 7
build: use latest pyo3 API
#34
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis 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.rsclassDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This PR uses the latest
pyo3API and bumps all dependencies. Instead of usingabi3-py38we will usepyo3-build-configfor 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:
Build: