Clean up imports throughout the code
Closed this issue · 2 comments
ScriptEngine-internal imports (i.e. one SE module needing symbols from another SE module) are note very consistent and clear. Sometimes, whole modules are imported and at other times, only some symbols from modules. This even leads to confusing situations in which symbols are provided by hidden chains of imports, such as in cli/se.py
, where
scriptengine.tasks.core.loader.load()
scriptengine.yaml.parse_file()
are used, but neither scriptengine.tasks.core.loader
nor scriptengine.yaml
are explicitly imported. The parse_file()
function, for example, is provided via se.scripts
-->se.scripts.simple_script_engine
-->se.tasks.core
-->se.yaml
.
The best-practise to apply shoud be
Import entire modules instead of individual symbols within a module.
There are some directories below scriptengine/
without the __init__.py
file, which implicitely makes those directories namespace packages. This is not wanted, need to add (empty) __init__.py
.
Once we get rid of the namespace packages for scriptengine.tasks
for good, also sciptengine/tasks/
should have a __init__.py
. Note that this will actually prevent SE task packages to use scriptengine.tasks
namespace packages!