Repository navigation
perf(postgrest): use JsonValue for JSON adapter - #1666
Closed
mdmoazzamg wants to merge 1 commit into
Closed
mdmoazzamg wants to merge 1 commit into
mdmoazzamg wants to merge 1 commit into
Conversation
Author
DescriptionUse Pydantic's built-in The previous implementation used a recursive custom Motivation
In the local benchmark, Changes
Testing
Also verified:
Closes #1486 |
Contributor
|
Superseded by #1902 |
spydon
added a commit
that referenced
this pull request
Nov 2, 2026
#1902) ## What Removes the pydantic v1 compatibility layer from `supabase_auth` and `postgrest`, and aligns their pydantic floor with storage and realtime at `>=2.11.7`, so every package in the repo has the same minimum. Resolves SDK-1694. Both packages already failed to import on pydantic 1.x, because they use `TypeAdapter` at module scope, so the v1 fallbacks were dead code and the declared ranges were wrong. ### postgrest (`pydantic >=1.9,<3.0` to `pydantic >=2.11.7,<3`) - Removed the `model_validate_json` fallback from `utils.py`. Call sites now call `APIErrorFromJSON.model_validate_json(...)` directly. - Removed `JSONAdapter` from `types.py`. Nothing has used it since #1571 and it was never exported. This supersedes #1666. ### auth (`pydantic >=1.10,<3` to `pydantic >=2.11.7,<3`) - Removed `model_validate`, `model_dump` and `model_dump_json` from `helpers.py`. Call sites now use the v2 model methods directly. - Replaced the `model_validator`/`root_validator` fallback in `types.py` with `@model_validator(mode="before")` and `@classmethod`. - Deleted the three tests that only exercised the v1 fallbacks. - Dropped the stale `with_config` comment about older pydantic versions. ## Why 2.11.7 for both `supabase` pins all five packages to the same release, and storage and realtime already require `>=2.11.7`, so that is already the effective floor for anyone installing `supabase`. A single floor also matches what CI tests, since CI runs against the locked version. For reference, the code alone would work on lower versions. Checked locally on Python 3.9: auth needs 2.7 (for the top-level `with_config` import) and postgrest works on 2.0. `uv.lock` only changes in the two `requires-dist` specifiers; resolved versions are unchanged. ## Testing - mypy passes for both packages. - `_sync/` was regenerated with `build-sync` and mirrors the `_async/` changes exactly. - Integration suites are left to CI.
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.
What kind of change does this PR introduce?
Bug fix, feature, docs update, ...
What is the current behavior?
Please link any relevant issues here.
What is the new behavior?
Feel free to include screenshots if it includes visual changes.
Additional context
Add any other context or screenshots.