-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Do not generate subnetworks all the time but provide them dynamically #810
Conversation
Subnetworks aren't shown in docs anymore... |
and I guess neither in the autocompletion, isn't? |
I don't think so. I work with vscode, which hadn't autocompletion for this dynamically generated properties anyway. |
I did some research about dynamic properties and autocompletion today. It's not possible to get static typing or type hints (as for mypy or any other typechecker) with dynamically created properties, as the type checker does not execute the code even once, that's why it's not aware of the dynamic attributes. Interactive Sessions like jupyter or ipython have a concept which is called autosuggestion which can handle dynamic properties. The list of available properties is taken from the dir() method. So this PR removes dynamic property setting and generates all available dynamic attributes on the fly, as the getattr() method is overloaded. Autosuggestion for interactive Sessions and Jupyter is done via the dir method. Open for Feedback :) If this works well, this method could be expanded to replace the code, which creates the plotting methods for a Network or NetworkSet |
Still have to investigate sphinx build |
what about what has been proposed in #828 concerning secondary properties? |
The secondary property generation is error prone in general and wouldn't be needed anymore. |
1007fb3
to
0d2db12
Compare
I think we can start review at this point, although I think we should not merge before 0.25 release. A follow up PR #848 will unify the plot code generation. |
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.
very nice addition, hats off!
OK for merging this PR? Or shall we wait for the #848? |
I think this one is fine. #848 already includes this PR, but isn't finished yet. |
Do not generate subnetworks all the time but provide them dynamically if requested.
This is an alternative approach for #807, open for discussion