Simplify api hierarchy
See original GitHub issueDescription
When using kedro as a user it can sometimes be hard to remember where even the most common kedro features are located.
Context
This will lower the barrier to entry to using kedro, and make it easier to use without needing to use the docs for even the most simple task such as “How do I make a node”.
Possible Implementation
To simplify the barrier to entry into kedro import the most commonly used features right into main.
WARNING - for the person browsing through, this is not the real api, this is simply a suggestion.
import kedro as kd
my_pipeline = kd.Pipeline([kd.node(create_cars, None, "cars")])
Alternatively users can also use the same api as so.
from kedro import Pipeline, node
my_pipeline = Pipeline([node(create_cars, None, "cars")])
At a minimum I feel that the very core features that every kedro user needs should be at the top of the api.
- Pipeline
- node
The next priority would be those used by hooks authors.
- KedroSession
- ConfigLoader
Finally the full scope of what should be considered to be made easy to reach should be every occurance of from kedro import x
in the project template.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:16 (16 by maintainers)
I am pretty sure this is the case and it’s just how Python works, and there isn’t much we can do here.
For example if you have a
__init__.py
which just has 1 line.Everytime you do
import kedro
, it will also importkedro.xxx
andkedro.xxx.yyy
andkedro.xxx.yyy.zzz
. Equally when people dofrom xxx.yyy.zzz import something
, it doesn’t save any memory magically as the top-level library is imported, it just import it into a local namespace and optionally have an alias.Direct Import
From import
A bit off topic but @noklam if you are interested in IDE/Notebook tooling I had this project that I haven’t found the time to develop further: https://github.com/Kedro-Zero-to-Hero/kedro-lsp – if you are interested, pls let me know.