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
Replaces mypy with pyrefly (1.4, stable since 1.0) as the type checker for every package. Resolves SDK-2624 and also covers SDK-2622, because all packages now share one config.
Configuration
pyrefly.toml at the repository root holds the shared rules. Each package's pyproject.toml has a small [tool.pyrefly] section that extends it and sets project-includes and search-path.
It uses the strict preset and required-version = ">=1.4.0,<2.0.0". It does not pin python-version, so each CI job type checks against its own interpreter (3.11 to 3.14).
enabled-ignores = ["pyrefly"]: only # pyrefly: ignore[code] suppresses errors, and unused-ignore (part of strict) flags stale ones.
make <pkg>.pyrefly replaces make <pkg>.mypy, and make <pkg>.tests (which CI runs) now type checks with pyrefly. utils is added to the CI matrix, because it was never type checked in CI before. mypy and pylsp-mypy are removed from the dependency groups, and storage's mypy group is renamed to typecheck.
Fixes found by pyrefly
__exit__/__aexit__ on the auth, postgrest, storage, supabase and utils clients were typed with type[Exception]. async with client: now type checks when a BaseException such as CancelledError is raised.
supabase.__all__ listed SupabaseAuthClient, ASupabaseAuthClient and SupabaseException, which no longer exist, so from supabase import * raised AttributeError.
supabase_auth and realtime now re-export their public names explicitly, so strict type checkers in user projects accept from supabase_auth import AsyncSupabaseAuthClient.
SupabaseAuthHttpClient is generic over its session manager, so subclasses no longer narrow a mutable attribute unsoundly.
Realtime Presence/PresenceMeta declare extra_items=Any (PEP 728) to match the pydantic extra="allow" they already had, so user presence keys type check. RealtimeClientOptions is closed=True, so it can be unpacked into connect_once.
FunctionsClient.invoke accepts bytearray in its signature, matching what it already handled at runtime.
The async supabase client no longer sets _postgrest/_storage/_functions. Those attributes were never read.
@override was added where methods override a parent, plus missing annotations, mostly in tests.
Notes
make auth.build-sync currently produces broken _sync tests (it imports SyncHttpxSession, which doesn't exist, and drops helpers). The _sync auth test edits here were therefore made by hand to mirror _async.
Five suppressions remain, each with a specific code: the intentionally deprecated postgrest SyncClient test, get_event_loop_policy in the storage test helper, ChannelEvents.join shadowing str.join, and a test that passes an invalid body on purpose.
Testing
make pyrefly: 0 errors in all seven packages.
make auth.tests, make postgrest.tests and make storage.tests with infra: all pass. Functions and supabase unit tests pass.
make realtime.tests: 38 passed. The 5 errors in test_reconnection.py are a port 55555 bind failure that also happens on main locally.
Function requests now accept bytearray bodies, converted to binary data before sending.
Presence data can include additional fields.
Bug Fixes
Auth state changes no longer clear cached service clients.
Functions error handling now consistently constructs base errors.
Chores
Replaced mypy checks with Pyrefly across packages and updated related project configuration.
The pull request replaces mypy with Pyrefly in repository and package Make targets and configuration. It adds type annotations across the auth, Functions, PostgREST, Realtime, Storage, Supabase, and utility packages. It also changes Functions request-body and region handling, PostgREST column inference, selected Supabase exports and auth-event handling, and Realtime typed-dictionary declarations. Tests receive type annotations and several assertion updates.
Possibly related PRs
supabase/supabase-py#1370: Introduces the package layout and shared HTTP types that this pull request configures for Pyrefly.
supabase/supabase-py#1939: Changes _unique_columns input handling, which this pull request also updates.
Change: Other
Merge Risk: Minimal · up to 433fb
The type-checker migration has no established merge-blocking regression. Mapping-row serialization compatibility remains unverified, but the relevant serialization behavior is unchanged.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Type checking now runs on pyrefly with a shared strict config in pyrefly.toml
that every package extends. On top of the strict preset it enables the mypy
strict equivalents plus extra checks for re-exports, TypedDict access,
deprecated APIs and dead code.
Fixes the type errors pyrefly found, including context managers typed with
Exception instead of BaseException, stale names in supabase.__all__ and
implicit re-exports in supabase_auth and realtime.
Pinning a single python-version made pyrefly resolve imports for that version
only, so jobs on other interpreters could fail on missing version-specific
dependencies. Each job now checks against its own interpreter. This also
installs the utils extras for its type check.
utils was missing from the test matrix, so its type errors were never caught
in CI. Its tests target only runs pyrefly, so the job skips the coverage
upload.
Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.
_unique_columns now collects keys only from dict rows, although the supplied JSON alias also permits other mappings. A supported non-dict mapping row may therefore have its column names omitted from an insert or upsert request.
PostgREST may omit the supplied field and insert a default value instead.
This can occur when: A bulk insert or upsert contains a non-dict mapping with a key absent from the dict rows, and the request serializer supports that mapping.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: eae63d2d-7741-4f06-91d0-1041f2a9962f
Commits
Reviewing files that changed from the base of the PR and between 78c1956 and 9d6a448.
Files ignored due to path filters: 1
uv.lock is excluded by !**/*.lock
Files selected for processing: 9
AGENTS.md
src/auth/pyproject.toml
src/functions/pyproject.toml
src/postgrest/pyproject.toml
src/postgrest/src/postgrest/client.py
src/postgrest/src/postgrest/request_builder.py
src/realtime/pyproject.toml
src/realtime/src/realtime/channel.py
src/utils/src/supabase_utils/http/io.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.
_unique_columns now recognizes non-dict mappings, but the insert/upsert request-body serializer may not encode those same rows. The new MappingProxyType test checks column inference without checking whether such a row can be sent.
Column inference succeeds, but constructing or sending the request raises a serialization error instead of inserting the row.
This can occur when: An insert or upsert receives a MappingProxyType row, as in the new test.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 5cc0ed43-ff3d-4f00-b422-89c8872f3b33
Commits
Reviewing files that changed from the base of the PR and between 9d6a448 and 433fbd9.
Files selected for processing: 3
.github/workflows/ci.yml
src/postgrest/src/postgrest/request_builder.py
src/postgrest/tests/test_unique_columns.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.
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.
What
Replaces mypy with pyrefly (1.4, stable since 1.0) as the type checker for every package. Resolves SDK-2624 and also covers SDK-2622, because all packages now share one config.
Configuration
pyrefly.tomlat the repository root holds the shared rules. Each package'spyproject.tomlhas a small[tool.pyrefly]section thatextendsit and setsproject-includesandsearch-path.It uses the
strictpreset andrequired-version = ">=1.4.0,<2.0.0". It does not pinpython-version, so each CI job type checks against its own interpreter (3.11 to 3.14).enabled-ignores = ["pyrefly"]: only# pyrefly: ignore[code]suppresses errors, andunused-ignore(part of strict) flags stale ones.Rules enabled on top of strict:
unannotated-parameter,unannotated-return,unannotated-attribute,no-any-return,untyped-function-decorator,untyped-class-decorator,untyped-importimplicit-reexport,implicit-import,unresolvable-dunder-all,deprecatednot-required-key-access,incompatible-comparison,invalid-cast,string-as-iterable,implicit-abstract-class,uninitialized-instance-variable,non-exhaustive-matchredundant-cast,redundant-condition,unnecessary-comparison,unnecessary-type-conversion,unreachable-except-clause,unreachable-match-case,misplaced-ignoremake <pkg>.pyreflyreplacesmake <pkg>.mypy, andmake <pkg>.tests(which CI runs) now type checks with pyrefly.utilsis added to the CI matrix, because it was never type checked in CI before.mypyandpylsp-mypyare removed from the dependency groups, and storage'smypygroup is renamed totypecheck.Fixes found by pyrefly
__exit__/__aexit__on the auth, postgrest, storage, supabase and utils clients were typed withtype[Exception].async with client:now type checks when aBaseExceptionsuch asCancelledErroris raised.supabase.__all__listedSupabaseAuthClient,ASupabaseAuthClientandSupabaseException, which no longer exist, sofrom supabase import *raisedAttributeError.supabase_authandrealtimenow re-export their public names explicitly, so strict type checkers in user projects acceptfrom supabase_auth import AsyncSupabaseAuthClient.SupabaseAuthHttpClientis generic over its session manager, so subclasses no longer narrow a mutable attribute unsoundly.Presence/PresenceMetadeclareextra_items=Any(PEP 728) to match the pydanticextra="allow"they already had, so user presence keys type check.RealtimeClientOptionsisclosed=True, so it can be unpacked intoconnect_once.FunctionsClient.invokeacceptsbytearrayin its signature, matching what it already handled at runtime._postgrest/_storage/_functions. Those attributes were never read.@overridewas added where methods override a parent, plus missing annotations, mostly in tests.Notes
make auth.build-synccurrently produces broken_synctests (it importsSyncHttpxSession, which doesn't exist, and drops helpers). The_syncauth test edits here were therefore made by hand to mirror_async.SyncClienttest,get_event_loop_policyin the storage test helper,ChannelEvents.joinshadowingstr.join, and a test that passes an invalid body on purpose.Testing
make pyrefly: 0 errors in all seven packages.make auth.tests,make postgrest.testsandmake storage.testswith infra: all pass. Functions and supabase unit tests pass.make realtime.tests: 38 passed. The 5 errors intest_reconnection.pyare a port 55555 bind failure that also happens onmainlocally.