-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
explicit Components classes to allow autocomplete #150
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
Comments
btw, I am not yet happy with the ISUNDEFINED and MUSTBEDEFINED sentinel approach... |
Thanks @sdementen ! Excited to check this out. I'm having a hard time finding the commits in |
sorry, it wasn't pushed correctly. You should be able to see them now. on the approach, I wonder if the metadata.py file should be "compiled" during the development/release cycle (and so included in the source), or generated on the fly (with some caching mechanism that checks metadata.json is newer than metadata.py) |
Great idea, I think that's it exactly. Here is a rough set of steps that would be required for creating these components at build-time vs run-time. cc @alysivji 1. Modify These functions are called at runtime by the component libraries, see e.g. https://github.com/plotly/dash-core-components/blob/c898d75a1a189943bcf92bc73b95bd08432ddd7d/dash_core_components/__init__.py#L8-L11 They consume a Note that We'll want to explore modifying this step so that it generates python code. Note that this template for the component code is already written - we'll just need to convert it from an dash/dash/development/base_component.py Lines 198 to 255 in 3cd6a78
We'll want to create a function like
2. Modify the This is the starter package that is used to generate Dash packages from React.js code. Each component library is initialized from this repository and each component library uses the NPM scripts from this component library through a package called " We'll need to modify these package's scripts to generate the python code. The command for this script will live here: https://github.com/plotly/dash-components-archetype/blob/67912c1a56a58fa68e1f00c90136af1d7ae444d9/package.json#L29-L43 and we can call it something like For example,
where the 3. Modify the The standard component
4. Modify the
4. Version management The new versions of the component libraries should also work with the new version of Dash but also the older versions of Dash. Since generating the components is done as a build-step instead of runtime, the components shouldn't even depend on the version of the 5. Testing
|
Sorry, did you mean to close this issue when you closed #226 ? |
This was added in #276 |
* license fixes for R * update manifest
* license fixes for R * update manifest
* license fixes for R * update manifest
I don't think this issue was properly closed and it is totally annoying behavior - why would a callback for a button need to be called when the callback has not been clicked yet??? The reference in the push above does not affect in any way this issue. |
metadata.zip
Currently, the Dash components classes are generated only at runtime. Therefore, it is not possible to get autocomplete feature or doc/help contextual hints in IDE (e.g. pycharm).
I would propose to explicit the classes as a real python module and so convert the metadata.json in a metadata.py that could be imported in a standard way.
It could also ease the debugging when adapting these component classes to implement the different TODOs in the code.
I have slightly adapted the
component_loader.py
as well as the__init__.py
of the dash_core_components and dash_html_components to achieve this.You can find in attachements the resulting metadata.py for both modules.
As this requires changes in different repos (dash but also the dash_*_components), I haven't yet done a PR on this.
If you find the approach valuable, I am ready to follow your guidelines on how to push the changes.
The text was updated successfully, but these errors were encountered: