Skip to content

Fix typing component generation & explicitize_args #3287

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 10 commits into from
Apr 23, 2025
Merged

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Apr 22, 2025

Comment on lines -28 to -30
try:
from dash.development.base_component import ComponentType # noqa: F401
except ImportError:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: types defined in try except don't always resolve.

Copy link
Contributor

Choose a reason for hiding this comment

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

that makes sense now that you've said it but damn - I'm liking Python's type system less and less as time goes by…

Comment on lines -28 to -30
try:
from dash.development.base_component import ComponentType # noqa: F401
except ImportError:
Copy link
Contributor

Choose a reason for hiding this comment

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

that makes sense now that you've said it but damn - I'm liking Python's type system less and less as time goes by…

ComponentType = typing.TypeVar("ComponentType", bound=Component)
from dash.development.base_component import Component, _explicitize_args
{custom_imports}
ComponentType = typing.Union[
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect this will eventually grow to Any :-)

"func": generate_any,
"element": generate_type("ComponentType"),
"element": generate_type("Component"),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -19,3 +19,4 @@ xlrd>=2.0.1
pytest-rerunfailures
jupyterlab<4.0.0
pyright==1.1.398;python_version>="3.7"
mypy==1.15.0
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


cmd = shlex.split(
f"pyright {codefile}",
f"{sys.executable} -m {module} {codefile}{extra}",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@T4rk1n T4rk1n merged commit 38f26fb into dev Apr 23, 2025
3 checks passed
@T4rk1n T4rk1n deleted the fix/typing-component-gen branch April 23, 2025 18:30
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.

[BUG] Large nr of myp errors when upgrading Dash 3.0.2 to Dash 3.0.3
2 participants