Skip to content

Export Core Supabase Classes and Functions Explicitly via __all__ #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

WesleyYue
Copy link
Contributor

@WesleyYue WesleyYue commented Feb 15, 2024

What kind of change does this PR introduce?

This PR introduces a code quality improvement to the Supabase Python SDK.

What is the current behavior?

Currently, the Supabase Python SDK does not explicitly define its public API using the all variable in its init.py file. This omission can lead tools like PyRight to raise warnings or errors about importing private members, like the components under _sync. See https://arc.net/l/quote/juxuoghj

What is the new behavior?

By specifying an all list in the init.py file of the Supabase Python SDK, we explicitly declare the public interface of the module. This declaration prevents PyRight and similar tools from complaining about the import of private members, thus clearing warnings/errors related to import visibility.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: This pull request introduces an enhancement to the Supabase Python SDK by explicitly defining its public API. It achieves this through the addition of an all list in the init.py file, which specifies the classes and functions that are intended for public use. This change is aimed at improving code quality by addressing issues related to the import visibility of unexported members, which can lead to warnings or errors from tools like PyRight.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.

General suggestions:

  • Ensure that all newly exported members are documented appropriately, highlighting their purpose and usage within the SDK.
  • Consider adding a brief comment above the all declaration explaining its purpose for future maintainers or contributors who might not be familiar with this Python convention.
  • Review the list of exported members to ensure it's comprehensive and only includes those intended for public use, to avoid any unintended exposure of internal functionality.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

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.

Thanks for the link! It was helpful in understanding the PR

@J0
Copy link
Contributor

J0 commented Feb 16, 2024

Ah mind running black before merging?

@WesleyYue
Copy link
Contributor Author

Yep I can do it tmr

@tinvaan
Copy link
Contributor

tinvaan commented Feb 20, 2024

Hi @WesleyYue , thanks for addressing this -- this looks useful. I'm also making some changes in another branch and it would be cool to rebase it on top of your changes <3

My changes aren't urgent and are meant to be more of a discussion seeking feedback on some design changes so I'll likely open a draft PR initially, but let me know whenever this is ready to land.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.51%. Comparing base (2bd19f3) to head (b360b57).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #691      +/-   ##
==========================================
+ Coverage   44.34%   44.51%   +0.16%     
==========================================
  Files          13       13              
  Lines         327      328       +1     
==========================================
+ Hits          145      146       +1     
  Misses        182      182              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@silentworks silentworks merged commit 5d04c4c into supabase:main Feb 22, 2024
@silentworks
Copy link
Contributor

Thanks for this PR @WesleyYue. The changes should be available in release 2.3.6 of the supabase-py package.

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.

4 participants