-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
try: | ||
from dash.development.base_component import ComponentType # noqa: F401 | ||
except ImportError: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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…
try: | ||
from dash.development.base_component import ComponentType # noqa: F401 | ||
except ImportError: |
There was a problem hiding this comment.
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[ |
There was a problem hiding this comment.
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"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
requirements/ci.txt
Outdated
@@ -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 |
There was a problem hiding this comment.
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}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
mypy
&pyright