You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
We'd like to use python hooks, rather than bash as it supports easy sharable libraries. However, I didn't find a way to manage those dependencies.
Could we imagine that cookiecutter runs a pip install -r requirements.txt contained in a template to install required dependencies for the hooks? Or do you prefer to keep this separated from cookiecutter?
We can likely provide a PR for this feat if you're interested in it 😄
Thanks!
The text was updated successfully, but these errors were encountered:
Cookiecutter currently does not have any built-in functionality to install packages for your hooks, but it is possible to use packages within your hooks. I'm not a core member of this project, but here's my two cents.
Unless there's something that I'm missing, cookiecutter and its hooks are ran on top of your current environment's Python binary/installation, so if you install the needed dependencies before running cookiecutter, you can import them within the hooks. If you need isolation, you can use pipx, venv, etc. to run cookiecutter in a virtual environment with your dependencies installed.
You can also use cookiecutter's hooks to act as a bootstrap for your actual hook scripts:
create and activate a virtual environment
install the needed dependencies
run your actual hook script
If cookiecutter were to add built-in functionality to install a hook's dependencies, I imagine that it would use a virtual environment to execute the hooks in the same way as I described above.
Hello,
We'd like to use python hooks, rather than bash as it supports easy sharable libraries. However, I didn't find a way to manage those dependencies.
Could we imagine that cookiecutter runs a
pip install -r requirements.txt
contained in a template to install required dependencies for the hooks? Or do you prefer to keep this separated from cookiecutter?We can likely provide a PR for this feat if you're interested in it 😄
Thanks!
The text was updated successfully, but these errors were encountered: