https://kedro.org/ logo
#questions
Title
# questions
j

Jorit Studer

11/22/2023, 9:23 AM
Hi all, when creating your own kedro starter cookiecutter template is there a way to execute a command after folder creation? What I would like to do is create a venv folder inside the created template and install the dependencies in one go. simply executing
kedro new —starter=…
m

Merel

11/22/2023, 9:25 AM
Cookiecutter comes with hooks that can be executed pre/post project generation: https://cookiecutter.readthedocs.io/en/1.7.2/advanced/hooks.html so you could add logic there to create the venv and install the dependencies.
n

Nok Lam Chan

11/22/2023, 11:35 AM
You can find an example here - https://github.com/kedro-org/kedro-starters/blob/main/spaceflights-pyspark-viz/hooks/post_gen_project.py Although I would say that create venv and install dependencies in
kedro new
may not be the best approach. This involve activating the new environment (which is different from the process that you run the command). Maybe a shell script or something like
Makefile
is more suitable for scripting.
j

Jorit Studer

11/22/2023, 11:39 AM
@Merel @Nok Lam Chan thank you, just what i was looking for 👍
m

Marshall

03/28/2024, 1:01 AM
pre_gen_project and post_gen_project: Scripts run in the root directory of the generated project, simplifying the process of locating generated files using relative paths.
https://cookiecutter.readthedocs.io/en/2.6.0/advanced/hooks.html#hook-execution Is there an easy way to find the root of the cookiecutter template instead of the generated project from either of these hooks?
n

Nok Lam Chan

03/28/2024, 10:16 AM
Hi Marshall, would you mind asking this in a separate thread and explains a little bit what you want to do? You have a better chance to get answers there since this is 4 months old already. I saw that you commenting from Linen, if you'd like to you can join us with slack.kedro.org
3 Views