You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the current import structure, this doesn't always make sense, for example we have a config module/package. Using names that are so generic are not always that clear with this scheme, as the user could also have some module called config.
Point 3 (minimize the amount of unused code that is indirectly imported) is also important. Since Python executes the code, and importing a modules can have arbitrary code execution, importing could be very expensive, and it could happen that just to import a small utility function, you end up importing the whole SDK, so it would be good to have this in consideration when thinking about a package/modules structure.
Point 5: 5. Logging normally uses the module name as logger. This means that logs produced in private modules for example (like package.some._module), the logger name will be weird, it will show package.some._module instead of the public module where symbols are exported (package.some).
What's needed?
We need to have a consistent modules and packages structure, so:
imports are clean and clearProposed solution
This is still to be researched and decided.
Use cases
No response
Alternatives and workarounds
No response
Additional context
There are a few other issues related to this topic:
Enforce Google-syle imports #222
With the current import structure, this doesn't always make sense, for example we have a
configmodule/package. Using names that are so generic are not always that clear with this scheme, as the user could also have some module calledconfig.Related issues and discussions:
pylintcheck for Google style imports frequenz-repo-config-python#14 (it would be good to check what kind of enforcement this does before going for this)Add modules for each component component in frequenz.sdk.microgrid #118
Is assuming we use google-style imports.
Point 3 (minimize the amount of unused code that is indirectly imported) is also important. Since Python executes the code, and importing a modules can have arbitrary code execution, importing could be very expensive, and it could happen that just to import a small utility function, you end up importing the whole SDK, so it would be good to have this in consideration when thinking about a package/modules structure.
Point 5: 5. Logging normally uses the module name as logger. This means that logs produced in private modules for example (like
package.some._module), the logger name will be weird, it will showpackage.some._moduleinstead of the public module where symbols are exported (package.some).Restructure timeseries module #704