-
Notifications
You must be signed in to change notification settings - Fork 20
Description
What's needed?
We need to have a consistent modules and packages structure, so:
imports are clean and clear- Chances of ending with cyclic imports are minimized or completely removed (Resolve potential cyclic import issues #84)
- We minimize the amount of unused code that is indirectly imported
- The generated documentation makes sense (see the issue in Evaluate if we want to use google-style imports or not frequenz-repo-config-python#56 for example)
- Logging makes sense
Proposed 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:
- Evaluate if we want to use google-style imports or not frequenz-repo-config-python#56
- Start following Google style imports #209
- Make
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).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status