Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Conversation

@leynier
Copy link
Contributor

@leynier leynier commented Oct 14, 2021

To Do:

  • Implement types with dataclasses
  • Implement sync/async support with httpx and unasync
  • Add pre-commit config to force Pythonic style
  • Synchronize implementation of GoTrueApi with the implementation of gotrue-js
  • Synchronize implementation of GoTrueClient with the implementation of gotrue-js
  • Synchronize tests implementation with the tests of gotrue-js

Tests:

  • apiWithAutoConfirmDisabled.test.ts
  • clientWithAutoConfirmDisabled.test.ts
  • clientWithAutoConfirmEnabled.test.ts
  • clientWithSignupsDisabled.test.ts
  • provider.test.ts
  • subscriptions.test.ts

Issues:

Fix #9
Fix #10
Fix #15
Fix #17
Fix #20
Fix #21
Fix #22
Fix supabase/supabase-py#70

Notes

  • The _sync folders are generated automatically with the make build_sync command.
  • All scripts in the _async folders will be translated into their synchronous form using unasync behind the scenes.
  • The set_auth_cookie and get_user_by_cookie methods of API later I don't think it still makes sense to have them in the Python library.

@leynier leynier changed the title Response dataclasses models instead of dicts Add dataclasses to responses, sync/async support, feature-parity with the js-client and tests Oct 17, 2021
@leynier leynier changed the title Add dataclasses to responses, sync/async support, feature-parity with the js-client and tests Add dataclasses, sync/async, feature-parity with the js-client and tests Oct 17, 2021
@leynier
Copy link
Contributor Author

leynier commented Nov 16, 2021

@leynier could you add the default x-header that #11 does, since that PR is done with the old version of this library, please?

I will do it right now 👍🏼

@J0
Copy link
Contributor

J0 commented Nov 16, 2021

@leynier will do!

@dreinon
Copy link
Contributor

dreinon commented Nov 16, 2021

What's dev container for @leynier ?

@leynier
Copy link
Contributor Author

leynier commented Nov 16, 2021

What's dev container for @leynier ?

https://code.visualstudio.com/docs/remote/devcontainerjson-reference

@leynier
Copy link
Contributor Author

leynier commented Nov 16, 2021

What's dev container for @leynier ?

It will make collaboration easier by defining a common sandbox for all developers among other things. It is not required to use, it is the decision of each dev at the end.

@dreinon
Copy link
Contributor

dreinon commented Nov 16, 2021

@J0 @anand2312 approve changes whenever you are done reviewing and we'll merge!

Copy link
Contributor

@anand2312 anand2312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; minor typo to be fixed

Co-authored-by: Anand <40204976+anand2312@users.noreply.github.com>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 17, 2021

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.57%.

Quality metrics Before After Change
Complexity 2.55 ⭐ 4.48 ⭐ 1.93 👎
Method Length 36.68 ⭐ 34.60 ⭐ -2.08 👍
Working memory 5.80 ⭐ 6.33 🙂 0.53 👎
Quality 83.02% 81.45% -1.57% 👎
Other metrics Before After Change
Lines 733 91 -642
Changed files Quality Before Quality After Quality Change
conftest.py 71.24% 🙂 71.16% 🙂 -0.08% 👎
docs/source/conf.py 97.17% ⭐ 97.17% ⭐ 0.00%
gotrue/init.py 100.00% ⭐ 94.35% ⭐ -5.65% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
conftest.py pytest_runtest_makereport 7 ⭐ 53 ⭐ 11 😞 67.21% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

1 similar comment
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 17, 2021

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.57%.

Quality metrics Before After Change
Complexity 2.55 ⭐ 4.48 ⭐ 1.93 👎
Method Length 36.68 ⭐ 34.60 ⭐ -2.08 👍
Working memory 5.80 ⭐ 6.33 🙂 0.53 👎
Quality 83.02% 81.45% -1.57% 👎
Other metrics Before After Change
Lines 733 91 -642
Changed files Quality Before Quality After Quality Change
conftest.py 71.24% 🙂 71.16% 🙂 -0.08% 👎
docs/source/conf.py 97.17% ⭐ 97.17% ⭐ 0.00%
gotrue/init.py 100.00% ⭐ 94.35% ⭐ -5.65% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
conftest.py pytest_runtest_makereport 7 ⭐ 53 ⭐ 11 😞 67.21% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@dreinon
Copy link
Contributor

dreinon commented Nov 17, 2021

@leynier do you think sourcery could be added to pre-commit hooks? It was added yesterday in the postgrest-py library.

repos:
  - repo: https://github.com/sourcery-ai/sourcery
    rev: v0.8.0 # Get the latest tag from https://github.com/sourcery-ai/sourcery/tags
    hooks:
      - id: sourcery
      # - args: [--in-place]  Automatically apply the refactorings in the hook

@leynier
Copy link
Contributor Author

leynier commented Nov 17, 2021

@leynier do you think sourcery could be added to pre-commit hooks? It was added yesterday in the postgrest-py library.

repos:
  - repo: https://github.com/sourcery-ai/sourcery
    rev: v0.8.0 # Get the latest tag from https://github.com/sourcery-ai/sourcery/tags
    hooks:
      - id: sourcery
      # - args: [--in-place]  Automatically apply the refactorings in the hook

I think it is not a good idea to add it as a pre-commit hook. Because I did the test by adding the hooks, that asked me for a login token, create the account and I log in, to log in I had to add sourcery-cli to the development dependencies and finally, I get this error.

image

I think it should just stay as a GitHub app associated with the repository and suggest changes to pull requests.

@leynier
Copy link
Contributor Author

leynier commented Nov 17, 2021

@leynier do you think sourcery could be added to pre-commit hooks? It was added yesterday in the postgrest-py library.

repos:
  - repo: https://github.com/sourcery-ai/sourcery
    rev: v0.8.0 # Get the latest tag from https://github.com/sourcery-ai/sourcery/tags
    hooks:
      - id: sourcery
      # - args: [--in-place]  Automatically apply the refactorings in the hook

I think it is not a good idea to add it as a pre-commit hook. Because I did the test by adding the hooks, that asked me for a login token, create the account and I log in, to log in I had to add sourcery-cli to the development dependencies and finally, I get this error.

image

I think it should just stay as a GitHub app associated with the repository and suggest changes to pull requests.

The same will happen with the postgrest-py repository, I also think that we should remove it from the hooks in that repository.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 17, 2021

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.57%.

Quality metrics Before After Change
Complexity 2.55 ⭐ 4.48 ⭐ 1.93 👎
Method Length 36.68 ⭐ 34.60 ⭐ -2.08 👍
Working memory 5.80 ⭐ 6.33 🙂 0.53 👎
Quality 83.02% 81.45% -1.57% 👎
Other metrics Before After Change
Lines 733 91 -642
Changed files Quality Before Quality After Quality Change
conftest.py 71.24% 🙂 71.16% 🙂 -0.08% 👎
docs/source/conf.py 97.17% ⭐ 97.17% ⭐ 0.00%
gotrue/init.py 100.00% ⭐ 94.35% ⭐ -5.65% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
conftest.py pytest_runtest_makereport 7 ⭐ 53 ⭐ 11 😞 67.21% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@angrycaptain19
Copy link

@leynier

Hey @leynier - sorry about this! I'm from the Sourcery team and we've rolled out the pre-commit option fairly recently. It's usually a part of our paid Team tier, but we definitely want it to be available for use for free for open source projects. I just gave you access to it, so it should now fully work if you wanted to try it out.

If you've got any feedback for us about the pre-commit hook or Sourcery more generally that would be incredibly helpful.

Thanks!

PS: @dreinon - I also gave you access to the pre-commit hook functionality

@dreinon
Copy link
Contributor

dreinon commented Nov 17, 2021

@angrycaptain19 thank you, we appreciate it! Nevertheless, we would need you to provide free access to any contributor that wants to submit a PR to our libraries without explicitly providing free access to their account, which wouldn't make sense since anyone would have free access to the hook by cloning the libs. Therefore, in my opinion, we still wouldn't be interested in adding the hook. Correct me if I'm wrong 😊

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 17, 2021

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.57%.

Quality metrics Before After Change
Complexity 2.55 ⭐ 4.48 ⭐ 1.93 👎
Method Length 36.68 ⭐ 34.60 ⭐ -2.08 👍
Working memory 5.80 ⭐ 6.33 🙂 0.53 👎
Quality 83.02% 81.45% -1.57% 👎
Other metrics Before After Change
Lines 733 91 -642
Changed files Quality Before Quality After Quality Change
conftest.py 71.24% 🙂 71.16% 🙂 -0.08% 👎
docs/source/conf.py 97.17% ⭐ 97.17% ⭐ 0.00%
gotrue/init.py 100.00% ⭐ 94.35% ⭐ -5.65% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
conftest.py pytest_runtest_makereport 7 ⭐ 53 ⭐ 11 😞 67.21% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Copy link
Contributor

@J0 J0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks great! Am looking forward to the new release :) Feel free to merge whenever ready.

@J0
Copy link
Contributor

J0 commented Nov 18, 2021

@leynier I couldn't quite find you on Discord but we would like to check if you'd be interested in becoming a maintainer of Gotrue-py. Let us know!

Alternatively, if you'd like to chat in private feel free to ping me at @J0 or @dreinon on Discord. Think both our handles.

@dreinon dreinon merged commit fb10c5c into supabase:main Nov 18, 2021
@leynier leynier deleted the feat/dataclasses branch November 18, 2021 12:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

5 participants