Open DJanyavula opened 1 year ago
Hey everyone,
I've been diving into some issues lately that really point towards the need for an upgrade to Cookiecutter 2.0
, particularly regarding the availability of context in pre- and post-generation hooks.
While working with templates that utilize pre_gen_project.py
scripts, it became evident that the inability to access context variables like {{ cookiecutter.project_name }}
is a significant limitation. (Pheval issue: monarch-initiative/pheval#265)This issue manifests in various forms, such as incorrectly named directories, which can derail the setup and initialization of projects.
The core of this problem has been already addressed in the Cookiecutter community, specifically through cookiecutter/cookiecutter#1339. This pull request, which has been merged, enhances how context is passed to hooks, but these benefits are only realized in versions 2.0 and above of Cookiecutter.
By adhering to cookiecutter>=1.7, users might encounter functionality issues that have been resolved in later versions. This adherence potentially limits the robustness of the templates created with Cruft.
Given the significance of context handling in the template generation process, I propose that Cruft's dependency on Cookiecutter be updated to >=2.0. This change would align Cruft with the latest improvements in Cookiecutter, ensuring a more stable and capable tool for the community.
Hello, Can we use cookiecutter > 2.0 as dependency instead of cookiecutter >=1.7.3 as there's a major upgrade now. For instance, I am using conda with python 3.10.6 and I have cookiecutter=1.7.3 installed by default in the venv. When I install cruft, since cookiecutter=1.7.3 is already installed, is reusing this version which has the bug to prompt for a private variable value (ref: https://github.com/cookiecutter/cookiecutter/issues/1502)