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

fix: solve mypy errors which are due to same object names in core.py and channels.py #3414

Merged
merged 3 commits into from
May 8, 2024

Conversation

binste
Copy link
Contributor

@binste binste commented May 5, 2024

Fixes #3408. See this comment for a description of the issue). This PR adds __all__ to core.py which includes all objects which were previously exported except for Color and Text which are names which are also defined in channels.py. With this, mypy can correctly detect the type of the top-level altair.Color and altair.Text as coming from channels.py and not core.py.

I've tested against the main branch that all objects are still exported except for some objects from typing which are not needed anyway. On the top-level of Altair, you can also see that nothing changed as the auto-generated _all__ in altair/__init__.py did not change. Hence, this is purely a fix for mypy and does not have any functional implications for users.

…exported from core.py so that altair.Color is correctly identified as coming from channels.py
@binste binste changed the title fix: solve mypy errors for altair.Color by being explicit in what is exported from core.py so that altair.Color is correctly identified as coming from channels.py fix: solve mypy errors which are due to same object names in core.py and channels.py May 5, 2024
Copy link
Contributor

@jonmmease jonmmease left a comment

Choose a reason for hiding this comment

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

Makes sense. If mypy and ruff are happy, I'm happy 😄
Thanks @binste!

@binste binste merged commit f1b4e2c into vega:main May 8, 2024
11 checks passed
@binste
Copy link
Contributor Author

binste commented May 8, 2024

Haha same here ;) Thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

alt.Color fails mypy --strict with error: Call to untyped function "Color" in typed context [no-untyped-call]
3 participants