Uh oh!
There was an error while loading. Please reload this page.
IDE support - #276
Conversation
rmarren1
commented
Jul 4, 2018
I've thought about the solution we discussed last stand-up, which would look something like this in a dash component and the current solution in this PR looks like this: the The object based solution has two benefits over the solution I have implemented in this PR,
and two drawback that I can think of:
The current solution also may work better if the default arguments were included, for example if a property had Anybody have thoughts on this or other drawbacks I haven't thought of, or have on opinion on which solution you prefer? I am personally for the current solution since I think the actual default value should be explicitly stated in the class code for documentation purposes (right now it is not in the docstring, the best place I know to look for it is the src/components/component.js). |
nicolaskruchten
commented
Jul 4, 2018
I think it might be nice to have a family of default values like It's definitely not Pythonic, but it would make for a nicer experience than |
nicolaskruchten
commented
Jul 4, 2018
(PS: the proposal above isn't just mine, it's something that was discussed briefly after the last call!) |
rmarren1
commented
Jul 4, 2018
That seems better than I think we have all the functionality of this already, albeit without the default value type being written out as they would be if we included those class names as default arguments (but that information is written in the docstring, the actual default value is not included there currently). E.g., errors are thrown if required arguments are not included, and optional and not included values are not passed to the base |
rmarren1
commented
Jul 15, 2018
Added more meaningful default arguments as discussed last standup, |
| else: | ||
| return ( | ||
| 'Table(' + | ||
| repr(getattr(self, self._prop_names[0], None)) + ')') |
There was a problem hiding this comment.
Do you see room for improvement in making these classes even more minimal? I don't think we have to do it in this PR, but in the future it might be nice if these classes were able to inherit more of this logic, mainly because it looks pretty gnarly 😉
There was a problem hiding this comment.
I think a lot of it could be moved into the base component (pretty much everything that is not an attribute assignment, and even some of those appear to be the same). I'll make a new issue for this
chriddyp
commented
Jul 31, 2018
Alright, I'm very happy with this. 💃 from me! |
Awesome! any docs or hint on how to integrate this with our IDE or editor? |
rmarren1
commented
Oct 5, 2018
What editor are you using? A lot of editors I tested work out the box if you install |
Akronix
commented
Oct 11, 2018
I'm using geany. |
This builds on #271 and adds explicit arguments to generated dash component python class
__init__functions (rather than**kwargs), which improves experience in an IDE.Atom example
Pycharm example
Jupyter Notebook example
Notes
dash_html_componentsordash_core_componentsare updated build using this version of thedashmodule, a user must also updatedashsince a new function_explicitize_argsis added todash.development.base_component. There are workarounds for this (putting the new function in the archetype generator or into the init.py file, or any shared file in a component module), but I think they are messy since it separates base component code into multiple repositories. I will add an exception to both of thedash-*-componentspackages that say to download the newdashversion.inspectwould not work for python2. They work for python 3 since we are able to change the function signature ofComponent.__init__to be correct even though it is actually(*args, **kwargs)after the_explicitize_argsdecorator is applied. This did not matter for Atom and PyCharm, but it seems Jupyter uses the inspect module to perform autocomplete.dashversion and keeping olddash_*_componentsmodules auto-magically adds the auto-complete functionality to Jupyter notebooks, but not Atom or PyCharm.