Skip to content

refactor: remove unused imports, variables and star imports - #1970

Merged
spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-2757-remove-unused-imports-and-variables
Nov 4, 2026
Merged

spydon merged 2 commits into
mainfrom
lukasklingsbo/sdk-2757-remove-unused-imports-and-variables

Conversation

@spydon

@spydon spydon commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Resolves SDK-2757.

What

Only realtime ignored F401 (unused import) and F841 (unused variable). The root pyproject.toml and every other package already enforced both. This removes the two ignores from src/realtime/pyproject.toml and cleans up the 82 violations they were hiding.

It also removes the F403 (star import) ignore from the root, supabase and realtime configs, and replaces the remaining star imports with explicit re-exports.

  • Removed 79 unused imports across realtime source and tests (json, re, sys, functools.wraps, urllib.parse helpers, yarl._query.get_str_query, legacy typing names like Optional and Union, and message/types names that were imported but never used).
  • Fixed the three unused variables in tests:
    • tests/test_presence.py: res = await chan.track(user1) became await chan.track(user1), keeping the call.
    • tests/test_reconnection.py: dropped as exc from except MaxRetriesExceeded and as channel from async with client.channel(...), keeping the context manager.

Public API

realtime/__init__.py already re-exports explicitly (import x as x) or through star imports, so ruff did not flag it. Nothing in sdk-compliance.yaml changed. The only visible effect is that the star imports of realtime.exceptions, realtime.message and realtime.types no longer leak a few third-party helpers that those modules imported without using them (Optional, Union, Any, Generic, Required, TypedDict and pydantic.Field). None of these were part of the realtime API.

Kept with noqa

None. No unused import or variable was a placeholder for unfinished work. The only TODO in realtime is about a payload type and is unrelated to these imports.

F403

Removed. The root, supabase and realtime configs no longer ignore it. The four star imports are replaced with explicit import X as X re-exports, in the style the __init__.py files already use:

  • realtime/__init__.py: from .exceptions import *, from .message import * and from .types import *.
  • supabase_auth/__init__.py: from .types import * # noqa: F403.

Each re-export list contains every public name the submodule defines (2 from realtime.exceptions, 25 from realtime.message, 37 from realtime.types and 95 from supabase_auth.types), and I checked that all of them are still importable from the package root. The only names that are no longer importable from the package roots are third-party helpers that the star imports leaked, such as BaseModel, Field, Literal, dataclass, datetime and override. Nothing in the repository imports them from there.

Checks

  • uv run --frozen ruff check and uv run --frozen ruff format --check pass from the repository root.
  • make <pkg>.pyrefly reports 0 errors for every package.
  • make realtime.tests: 43 passed.
  • make auth.tests: 213 passed.
  • make supabase.tests: 39 passed.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 70800f64-cbde-4ff4-9a28-454cb5d0fac3
Commits

Reviewing files that changed from the base of the PR and between 688ec1e and 1082f08.

Files selected for processing: 5
  • pyproject.toml
  • src/auth/src/supabase_auth/__init__.py
  • src/realtime/pyproject.toml
  • src/realtime/src/realtime/__init__.py
  • src/supabase/pyproject.toml

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Updated package guidance to require Python 3.11 or later.
    • Refreshed installation instructions and issue-reporting links.
  • Chores
    • Updated development container setup and tooling across the workspace.
    • Modernized Python type annotations and expanded declared support through Python 3.14.
    • Updated package build configuration.

The pull request updates development-container configuration and package metadata across the repository. It raises documented and classified Python support to 3.11–3.14, updates build requirements and Ruff settings, and modernizes typing annotations in package source and tests. The summaries report no runtime behavior changes for the annotation updates.

Possibly related PRs

Change: Refactor

Merge Risk: Minimal · previous review 688ec

This cleanup has no identified merge-blocking issue and is mergeable subject to normal checks.

- [ ] 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.

Share
Recent 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: 5ea4855e-d212-4d75-9194-523c9fcafbd0
Commits

Reviewing files that changed from the base of the PR and between f73c54d and 688ec1e.

Files selected for processing: 9
  • src/realtime/pyproject.toml
  • src/realtime/src/realtime/channel.py
  • src/realtime/src/realtime/client.py
  • src/realtime/src/realtime/message.py
  • src/realtime/src/realtime/presence.py
  • src/realtime/src/realtime/types.py
  • src/realtime/tests/test_connection.py
  • src/realtime/tests/test_presence.py
  • src/realtime/tests/test_reconnection.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.

Base automatically changed from chore/align-outdated-tooling to main November 4, 2026 13:50
@spydon
spydon force-pushed the lukasklingsbo/sdk-2757-remove-unused-imports-and-variables branch from f73c54d to 688ec1e Compare November 4, 2026 13:55
@spydon spydon changed the title refactor: remove unused imports and variables refactor: remove unused imports, variables and star imports Nov 4, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Nov 4, 2026
2 of 3 tasks
@spydon
spydon merged commit 2f66f8c into main Nov 4, 2026
50 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-2757-remove-unused-imports-and-variables branch November 4, 2026 14:11
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