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

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)

@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>

@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.

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

@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 <[email protected]>
Co-authored-by: Freddy Boulton <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>
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