-
Notifications
You must be signed in to change notification settings - Fork 250
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
Standard way of importing python-modules #5402
Comments
Thanks for starting this discussion. I also think that explicit relative imports are easy to read for imports from within an application (package). However we will implement in #5262 what will be decided here to be Kratos style conform. |
@armingeiser @philbucher i do not want to enter in stylistic questions, |
@KratosMultiphysics/technical-committee promotes the absolute import rather than the relative one due to its clarity and considering that we don't have many imports in each file, so the verbosity wouldn't be a problem. |
closing since I added it to the style guide: /~https://github.com/KratosMultiphysics/Kratos/wiki/Style-Guide#imports |
With the "old" way of importing applications being deprecated, we now should find a common solution for importing the python scripts
Previously we had to do:
now we have several options:
However, what is also possible and where we had several discussions (e.g. here and here) are explicit relative imports:
from PEP8:
"Absolute imports are recommended, as they are usually more readable and tend to be better behaved ..."
"However, explicit relative imports are an acceptable alternative to absolute imports, especially when dealing with complex package layouts where using absolute imports would be unnecessarily verbose"
I tried both ways already and suggest (up for discussion the following):
=> especially when there is a subfolder-structure inside
python_scripts
(which is now possible and already in use, see CoSimApp and HDF5App) since it can make the paths much shorterFYI @armingeiser @adityaghantasala
The text was updated successfully, but these errors were encountered: