You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
set context to be empty dict as default instead of Optional
none important change, the cors headers becom a vec of string
update stub gen file
remplace oncel and lazy by pyoncelock gil compatible
Update oxapy/init.py
remove once cell deps, use pyoncelock for global static
fix: potential security issue with path
not leak server directory
add secure join to fix security issue with static file handler
use normpath instead of abspath
improve securite to avoid path traveral
replace wrap struct to function
Summary by CodeRabbit
Refactor
Internal modernization of type handling and code structure across core modules to improve maintainability and type safety. No changes to user-facing functionality or behavior.
✏️ Tip: You can customize this high-level summary in your review settings.
This PR upgrades PyO3 bindings from Py<PyAny> to Bound<'_, PyAny> throughout the codebase, introduces explicit Python GIL tokens to multiple functions, and replaces wrapper-based type conversions with direct helper functions (from_pydict2rstruct, from_rstruct2pydict). JSON serialization is refactored to use direct orjson calls.
Changes
Cohort / File(s)
Summary
Type Annotation Updates oxapy/__init__.py
Added type-ignore comments (ty:ignore) to suppress unresolved reference errors in static analysis; no behavioral changes.
Core JSON Module Refactoring src/json.rs
Introduced orjson(py) helper; replaced dumps/loads signatures to accept Bound<PyAny>/Bound<PyDict> and explicit Python tokens; removed Wrap<T> newtype and added from_pydict2rstruct<T> and from_rstruct2pydict<T> public helpers for conversions via JSON serialization.
Response Conversion Updates src/into_response.rs
Updated TryFrom implementations from Py<PyAny> to Bound<'_, PyAny> in both single-value and tuple-based variants; adjusted JSON dumping calls to pass both the bound object and its Python reference.
JWT Verification src/jwt.rs
Updated verify_token to accept Python<'_> parameter and return PyDict; replaced Wrap-based conversions with new json::from_rstruct2pydict helper.
Request Body Parsing src/request.rs
Updated json() method signature to accept Python<'_> parameter; pass py token to json::loads call.
Response JSON Serialization src/response.rs
Updated from_json to pass Python object and its reference to json::dumps.
Serializer Validation src/serializer/mod.rs
Added Python<'_> parameter to is_valid method; updated JSON loading calls and replaced dict-to-JSON conversion with json::from_pydict2rstruct.
🐰 From Py to Bound, we leap and bound,
With GIL tokens held up high,
Wrap bows out, conversions shout,
PyO3's modern way—no lie!
Refactor done, the work is fun! 🎉
✨ Finishing touches
📝 Generate docstrings
📜 Recent review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 23a8a40 and cb24c38.
📒 Files selected for processing (9)
oxapy/__init__.py
src/into_response.rs
src/json.rs
src/jwt.rs
src/request.rs
src/response.rs
src/serializer/mod.rs
src/templating/minijinja.rs
src/templating/tera.rs
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.