Open tinvaan opened 8 months ago
On a related note, would it make sense to return the relevant go-true client directly in auth_client.py
instead of the wrapped clients ? -- why/why not?
https://github.com/supabase-community/supabase-py/blob/main/supabase/_sync/auth_client.py#L12
/cc @J0 , @olirice , @silentworks
There are no manual duplication being done in the codebase as we have a make
command we run to create the sync
code. We have these separate because not all Python framework's support async and I think the libraries were originally written as a sync
library. We are always open to ways of improving the codebase and will take a look at your PR.
Thanks @silentworks. Yeah, in that case I don't see any reason to check in the generated _sync
folder in to version control. The _sync
folder can be generated on the fly during the release as it is practically just a build artifact.
That said, I'd feel more confident in releasing code that we actively maintain and track in version control and has sufficient test coverage. Hence, making this unification attempt.
Please correct me if I'm wrong^
Just a heads up that there is a WIP changeset over at https://github.com/tinvaan/supabase-py/pull/2
Is there a simple working minimal tutorial for the async client? I am writing some features for a FastAPI backend and would like to understand best practices for initializing the client for some helping functions that query different tables.
Is there a simple working minimal tutorial for the async client? I am writing some features for a FastAPI backend and would like to understand best practices for initializing the client for some helping functions that query different tables.
+1, could we have some examples of FastAPI + async supabase client initialization?
cc: @silentworks @grdsdev @juancarlospaco
[This is more of a question at this point and not a feature request as such, so I'm diverging from the issue template.]
I noticed that there is a ton of shared and redundant code between the sync and async client classes. From what I'm seeing, there is only one place where a coroutine gets
await
ed in the async class (i.e while fetching the session token fromAsyncGoTrueClient
).Does it make sense then to attempt to converge the two classes into one? if not, what are some of the challenges in doing so?
I've attempted a converge at https://github.com/tinvaan/supabase-py/pull/2 . It's very early days still and I haven't had a chance to test the changes completely yet. But interestingly we can get rid of a lot of redundant code in this approach and as you can see in the linked PR, the code coverage jumps up significantly as a result.
However, I'd like to hear the community's thoughts on if this was attempted before or if indeed such a change makes sense.