Skip to content
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

Declare exports in __all__ for type checking #10238

Merged
merged 11 commits into from
Dec 23, 2024
Merged

Declare exports in __all__ for type checking #10238

merged 11 commits into from
Dec 23, 2024

Conversation

dustalov
Copy link
Contributor

Description

When a project using Gradio enforces strict type checking, it results in errors due to missing symbols in Gradio's __all__ list: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport.

This pull request fixes the issue by explicitly exporting the necessary symbols in __init__.py.

Closes: dustalov/evalica#25 (it impacted my personal project and the fix worked well for me)

Verified

This commit was signed with the committer’s verified signature.
@abidlabs
Copy link
Member

Thanks @dustalov! I think this should be good, let me cc @aliabid94 @freddyaboulton for review

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 22, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/cf2d0f68f8fc100f945d710c8dff949f75f4ce56/gradio-5.9.1-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@cf2d0f68f8fc100f945d710c8dff949f75f4ce56#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/cf2d0f68f8fc100f945d710c8dff949f75f4ce56/gradio-client-1.8.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/cf2d0f68f8fc100f945d710c8dff949f75f4ce56/dist/lite.js""></script>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 22, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
gradio_client patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Declare exports in all for type checking

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

Sorry, something went wrong.

Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

Thanks @dustalov ! Confirmed this fixes the issue on a fresh install

image

freddyaboulton and others added 8 commits December 23, 2024 11:58

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@abidlabs abidlabs enabled auto-merge (squash) December 23, 2024 22:00
@abidlabs abidlabs merged commit 3f19210 into gradio-app:main Dec 23, 2024
22 checks passed
@abidlabs
Copy link
Member

Thanks again @dustalov! I fixed some other typing issues and merged

dawoodkhan82 pushed a commit that referenced this pull request Dec 27, 2024
* Declare exports

* add changeset

* type fixes

* more type fixes

* add changeset

* notebooks

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
abidlabs added a commit that referenced this pull request Jan 4, 2025
* save history prototype

* add changeset

* Declare exports in __all__ for type checking (#10238)

* Declare exports

* add changeset

* type fixes

* more type fixes

* add changeset

* notebooks

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Add `gr.BrowserState` change event (#10245)

* changes

* changes

* add changeset

* format

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>

* history

* changes

* changes

* changes

* history

* changes

* changes

* changes

* format

* add changeset

* changes

* changes

* more changes

* changes

* dataset changes

* changes

* add changeset

* add md variant for button

* add changeset

* changes

* changes

* format

* format

* add changeset

* changes

* changes

* more changes

* changes

* changes

* add changeset

* changes

* docs

* changes

* changes

* changes

* changes

* fix

* fix tests

* change

* add changeset

* fix logo issue

* changes

* version

* add changeset

* fix typecheck

* remove redundant

* pkg version

* add changeset

* changes

* Revert "changes"

This reverts commit 13bfe8c.

* reorganize code

* format

* changes

* add to deployed demos

* fix icons

* fix icon

* lint

* changes

* example

* changes

* fix buttons

* add changeset

* format

* add changeset

* update icon

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Dawood <dawoodkhan82@gmail.com>
Co-authored-by: Dmitry Ustalov <dmitry.ustalov@gmail.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
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.

mypy fails to check Gradio frontend
4 participants