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

Run pyright on components directory #4948

Merged
merged 6 commits into from Jul 18, 2023
Merged

Conversation

freddyaboulton
Copy link
Collaborator

Description

pyright command is not recursive so components directory is not checked. Will fix after release.

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests & Changelog

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

  3. Unless the pull request is labeled with the "no-changelog-update" label by a maintainer of the repo, all pull requests must update the changelog located in CHANGELOG.md:

Please add a brief summary of the change to the Upcoming Release section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

@vercel
Copy link

vercel bot commented Jul 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
gradio ✅ Ready (Inspect) Visit Preview Jul 18, 2023 4:31pm

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jul 17, 2023

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4948-all-demos


You can install the changes in this PR by running:

pip install https://gradio-builds.s3.amazonaws.com/181c6721b6c57eb533d4c8e781aeda75917f63b8/gradio-3.37.0-py3-none-any.whl

@freddyaboulton freddyaboulton changed the title WIP: Apply pyright components WIP: Run pyright on components directory Jul 17, 2023
@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jul 17, 2023

🎉 Chromatic build completed!

There are 24 visual changes to review.
There are 0 failed tests to fix.

@@ -76,6 +76,10 @@ include = [
"/requirements.txt",
]

[tool.pyright]
include = ["gradio/**/*.py"]
exclude = ["gradio/themes/"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will be pretty hard to type themes given the dynamic nature of all the theme props.

@@ -415,10 +415,10 @@ def postprocess(self, y: pd.DataFrame | dict | None) -> dict[str, str] | None:
tooltip=self.tooltip,
x_title=self.x_title,
y_title=self.y_title,
color_legend_title=self.color_legend_title,
color_legend_position=self.color_legend_position,
color_legend_title=self.color_legend_title, # type: ignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why pyright is inferring these as str instead of Literal could be a bug

@@ -76,6 +76,10 @@ include = [
"/requirements.txt",
]

[tool.pyright]
include = ["gradio/**/*.py"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should catch all python files in the package

@freddyaboulton freddyaboulton marked this pull request as ready for review July 17, 2023 22:29
@abidlabs
Copy link
Member

LGTM @freddyaboulton nice catch!

@freddyaboulton freddyaboulton changed the title WIP: Run pyright on components directory Run pyright on components directory Jul 18, 2023
@freddyaboulton
Copy link
Collaborator Author

Thanks @abidlabs !!

@freddyaboulton freddyaboulton merged commit 5dba3b2 into main Jul 18, 2023
14 checks passed
@freddyaboulton freddyaboulton deleted the apply-pyright-components branch July 18, 2023 17:31
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.

None yet

3 participants