-
Notifications
You must be signed in to change notification settings - Fork 908
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
Spike: Make cookiecutter
optional / not a core dependency of kedro
#3884
Comments
#2928 was prioritised as "High" and this issue blocks progress on that one, so I am prioritising this one as "High" too. |
cookiecutter
optional / not a core dependency of kedro
cookiecutter
optional / not a core dependency of kedro
A couple more details about the issue: Our whole project creation flow currently relies on cookiecutter for creating new projects, and for creating pipelines as well. This bumps into the problems mentioned by @astrojuanlu, since cookiecutter is pretty intense when it comes to dependencies. As of now, cookiecutter is performing three functions on Kedro: Project templates This is what advertises itself for. It's a templating tool. We use it to fetch directory structure and pre-created files from both the Kedro repo itself and the kedro-starters repo. Which leads to... Git operations To fetch those templates, cookiecutter uses functions that do operations like cloning a repo or checking out a branch. This can become a bit of an issue from the developer side, because we cede control to an external library to do these operations and it can be tricky to debug. For example, this bit on the result_path = cookiecutter(template=template_path, **cookiecutter_args) From then on, cookiecutter takes over and will do the whole cloning, selecting the right branch or tag of the repo, and creating the project itself. It's convenient, and at this moment our whole project creation from Prompting This was the one that caused the issue when we tried to remove Rich as a mandatory dependency. That one The TL;DR is that our whole project creation flow is a funnel that ends on cookiecutter. |
Thanks for the comprehensive write-up @lrcouto ! So am I correct in thinking that if a user already has a Kedro project (e.g. cloned from a repo) they can do everything they want in Kedro without needing cookiecutter? |
We're also using it to create new pipelines using the |
In other words, if we consider The tricky bit here is for 0.19, we need to maintain backward compatibility. In 0.20, we can definitely split it to I have test it today, after
In fact,
Code: kedro/kedro/framework/cli/utils.py Lines 362 to 369 in b6e585f
|
For the records, there are proposal for optional This problem is also not unique to us, see this quote from the FastAPI's author in the same thread, he has issue with
Long story short, there are plenty of discussion but until today it's not supported (PEP doesn't exist yet). I thought it's a good idea to take inspiration from Pydantic: FastAPI:
In fastapi[standard], it install In FastAPI case, it makes sense since it's a web application and the CLI part isn't a runtime requirements when served. For Kedro, the CLI is a core part. If we only split the "cookiecutters" part, it's too small and IMO not worth the effort with little gain. When one install |
This is my proposed solution: 1. Move
|
Big fan of (2), |
Besides Nok's proposal, another idea to at least stop relying on Rich would be to try to handle the prompting outside of the cookiecutter context. That would allow us to keep everything mostly as it and not have to downgrade the Cookiecutter version if we want to remove Rich. I do think it would be a bit of reinventing the wheel though, since we'd have to create something that Cookiecutter is already doing. |
On that idea, @ankatiyar suggested looking into Click's prompting functions to possibly replace Cookiecutter's. @noklam opened an issue on the Cookiecuter repo regarding their own dependency on Rich. |
(2) that FastAPI takes is a bit different, basically I do like that both |
Cookiecutter use |
See this from the fastapi community. Some arguments I see there:
|
I get it: plugins depending on And yet, as @/tiangolo explains here:
He got quite a bit of opposition, but I completely agree with his stance (and Sebastián's intuition for DX is what brought FastAPI this far anyway). One insightful comment by the way:
|
I actually prefer option 1 of @noklam's proposals. We already have the concept of I can see why people like option 2, but with that one we need to think more about whether we would then break up Kedro in a modular way, where you can "add-on" parts by doing |
We will be closing this issue for now, based on this discussion on Kedro's dependencies. We have decided on a longer term approach to deal with Cookiecutter, and by extension Rich, that will take some time to design and implement. This issue will be addressed once we're ongoing with this process. |
Description
cookiecutter
is a mandatory dependency ofkedro
, because it's what powerskedro new
andkedro pipeline create
.However, it's a heavy dependency. From #3659:
Currently we are forcing Kedro users to install dependencies that are needed for development (
kedro new
,kedro pipeline create
) also in their production environments.One of those problematic transitive dependencies is
rich
. As of #3838,kedro
can work even ifrich
is not installed, but the current method to do that is very brittle and difficult for users. As a result, we are effectively blocked from making progress with #2928.For backwards compatibility reasons,
pip install "kedro==0.19.*"
will need to keep carryingcookiecutter
as a dependency. The task then is to come up with a roadmap in whichpip install "kedro>=0.20"
does not.The text was updated successfully, but these errors were encountered: