-
Notifications
You must be signed in to change notification settings - Fork 913
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
Simplify api hierarchy #712
Comments
I think this is a great idea. Just thinking out loud here: one thing that will land in 0.17.2 is the ability to import user-defined
This So essentially there will 2 things you can to import from
For the first one, importing from |
Do other frameworks do this? I feel that its a bit confusing to get project defined objects from kedro rather than |
Django is a (pretty big) example that I've seen work really well. You define your settings in # project/settings.py
MY_SETTING = 1 if os.environ["env"] == "production" else 0
# project/any_file.py
from django.conf import settings
if settings.MY_SETTING == 1:
blah with this justification (that I've seen work well in practice):
|
The main reason why we have to provide these imports on the As @mzjp2 pointed out, this approach is very similar to Django's and dynaconf's. |
Pinning setuptools's upper bound will cause conflict with dependencies in user's projects that don't pin it. For example, consider a user's project which has the following in their requirements.txt, which is very common: ``` ipython kedro ``` Ipython also specifies setuptools as a dependency without an upper bound and it is always listed before Kedro in alphabetical order. When pip tries to resolve dependency, at the moment, since it only performs conflicts resolution in a "first-encounter wins" manner, it will register latest setuptools from IPython as a dependency, which will conflict with Kedro's pinned version. If user moves IPython below Kedro, it should work correctly again. So to be absolutely certain, this commit unpins setuptools.
This is a very interesting approach that is a mix of mind-blowing and confusing to me, mostly because I have not used a framework that does this and not something I expect. It's definitely a big mental shift to import something that I created starting from |
I think we should make this happen. As @WaylonWalker says, we don't have to work everything out now, but Overall the only question in my mind here is what exactly the structure should be:
1 seems easiest for users to remember, and I don't imagine us ending up with too many components at that top level, but maybe 2 is more correct somehow. I don't know - thoughts very welcome! Maybe @deepyaman @noklam? Given this issue has an unprecedented number of positive reactions, it's clearly popular and so it would be nice if we could move forward with it. |
@AntonyMilneQB I think there are definitely opportunities to simplify the I am not sure though if the original issue suggests changing our folder structure. I thought it can be done with a This is more inline with We should also do something with In reality, I don't know how often people actually need to import these stuff, but the most useful one for me is inside an interactive environment like Jupyter, so I can do |
I think the autosuggestion of dataset names in the catalog in an interactive workflow is already available. I think @datajoely added it iirc. Re API: I have been doing a lot of Django lately and they expose some commonly used functions through a |
The last time I tried I don't remember seeing the datasets shortcuts, maybe I did something wrong there. I think there are some gaps between using IDE and Jupyter/Databricks, it doesn't come with things like IntelliSense / Pylance that guess the import for you. |
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. |
My view is that LSP is the right solution for all of this :) |
@noklam - sorry I wasn't clear. What I meant by @limdauto that's interesting about |
@limdauto This is something that I have no experience but it looks very interesting! Any recommended resource for a complete beginner :) I'll try to look at it sometimes |
@noklam I think kedro-lsp is a PoC so it's dead simple and therefore could be a good place to start. Apart from that, I think this is a good guide to language server protocol: https://microsoft.github.io/language-server-protocol/#:~:text=A%20Language%20Server%20is%20meant,servers%20and%20development%20tools%20communicate. In the end of the day it's a JSON-RPC server that responds to requests from an IDE. |
Notes from Technical Design session 20/7: DiscussionThis issue was discussed during a Technical Design session and the following points where brought up: The idea of moving our imports to higher level or even top level for the core Kedro components, sounds like a good idea, but it depends on a couple of things:
Instead of moving imports all the way to top-level we could have something like a "shortcuts" or "library" section, which is what Django is doing.
|
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 import kedro.xxx.yyy.zzz Everytime you do Direct ImportFrom import |
Vomiting some initial thoughts (based on what I remember):
|
Importing everything in And, as mentioned in #712 (comment), some imports are already only 1 level deep. At the moment (2.5 years after this issue was opened), pipeline code does the following:
I don't think that's excessively verbose, and changing it to
certainly does not seem like a huge life saver compared to the churn it would cause. The issue of tab-completion confusing users is being tracked in #2805. I am voting to close this one. |
We decided not to do this for now, we are open to reconsidering this in the future. If you'd like to see this happening, please drop a comment here. |
Description
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.
Alternatively users can also use the same api as so.
At a minimum I feel that the very core features that every kedro user needs should be at the top of the api.
The next priority would be those used by hooks authors.
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.The text was updated successfully, but these errors were encountered: