supabase / supabase-py

Python Client for Supabase. Query Postgres from Flask, Django, FastAPI. Python user authentication, security policies, edge functions, file storage, and realtime data streaming. Good first issue.
https://supabase.com/docs/reference/python
MIT License
1.65k stars 192 forks source link

2.7.0 SupabaseRealtimeClient import missing #895

Closed dpills closed 1 month ago

dpills commented 1 month ago

Bug report

Describe the bug

Running supabase 2.7.0 raises a ModuleNotFoundError due to not removing the SupabaseRealtimeClient import.

To Reproduce

Run a python script utilizing supabase 2.7.0.

Bad Import

https://github.com/supabase/supabase-py/blob/main/supabase/client.py#L19

# Lib
from .lib.client_options import ClientOptions
from .lib.realtime_client import SupabaseRealtimeClient

Removed from lib

https://github.com/supabase/supabase-py/blob/main/supabase/lib/__init__.py

https://github.com/supabase/supabase-py/commit/08496eb4c1c203d2806fc44753f3bddc4b463db0#diff-27f9014923633cc0c1a17e708523fcf210a925174ae73578db53383ce6f95cd9

System information

Traceback

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/user/projects/project/api/app/main.py", line 13, in <module>
    from app.routers.auth import auth
  File "/Users/user/projects/project/api/app/routers/auth/auth.py", line 11, in <module>
    from app.utilities.clients import get_supabase_public_client
  File "/Users/user/projects/project/api/app/utilities/clients.py", line 7, in <module>
    from supabase.client import ClientOptions
  File "/Users/user/Library/Caches/pypoetry/virtualenvs/api-F9Sx80VA-py3.12/lib/python3.12/site-packages/supabase/client.py", line 19, in <module>
    from .lib.realtime_client import SupabaseRealtimeClient
ModuleNotFoundError: No module named 'supabase.lib.realtime_client'
grdsdev commented 1 month ago

Hi @dpills thanks,

quick question, are you using SupabaseRealtimeClient somehow? Or is just facing issue with the wrong import from client lib?

dpills commented 1 month ago

@grdsdev Nope, I am not importing or using the realtime client in this application and it is throwing that error on startup. From the stack trace, it seems like this occurs when importing ClientOptions to instantiate the client.

This is the config I am using.

from supabase import create_client
from supabase.client import ClientOptions

from app.config import settings

supabase = create_client(
    settings.supabase_url,
    settings.supabase_key,
    options=ClientOptions(
        postgrest_client_timeout=10,
        storage_client_timeout=10,
        schema="public",
    ),
)
grdsdev commented 1 month ago

Got it, pushing a fix ASAP

dpills commented 1 month ago

@grdsdev Awesome, thanks for the quick fix and I really appreciate all the work on this Supabase client. 🙂