Hi all, when creating your own kedro starter cooki...
# questions
j
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
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
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
@Merel @Nok Lam Chan thank you, just what i was looking for 👍
m
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
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