Skip to content

Custom typing generator #3152

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 3 commits into from
Feb 7, 2025
Merged

Custom typing generator #3152

merged 3 commits into from
Feb 7, 2025

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Feb 6, 2025

Add custom typing for component props, previously hardcoded for dcc.Graph.
Component libraries developer can add a file dash_prop_typing containing one or two variables:

  • custom_imports: dict[ComponentName, list[str]] import statement to be copied at the top of the component class definition.
  • custom_props: dict[ComponentName, dict[PropName, function]] for custom props. The function signature is: def generate_type(type_info, component_name, prop_name) -> str.

The module path can be changed with the dash-generate-components argument -t or --custom-typing-module.

@T4rk1n T4rk1n merged commit eba4ccf into dash-3.0 Feb 7, 2025
3 checks passed
@T4rk1n T4rk1n deleted the custom-typing-generator branch February 7, 2025 14:37
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.

2 participants