I have a peculiar use case for a nested cookiecutter structure. My aim is to have:
- an "outer" template that can be cut straight from GitHub;
- an "inner" template that can be cut locally to generate templated subfolders inside the outer template.
It's a different use case from the multiple "parallel" cookiecutters case detailed in the docs.
This is an example of the folder structure I'm trying:
cookiecutter-for-analysis
├── cookiecutter.json
└── {{cookiecutter.repo_name}}
├── README.md
├── .gitignore
└── project_template
├── cookiecutter.json
└── {{cookiecutter.analysis_name}}
├── README.md
├── pyproject.toml
├── .gitignore
├── notebooks
└── sql
Within the outer cookiecutter.json I define (among other things) repo_name, so that when I run
cookiecutter cookiecutter-for-analysis
a folder called repo_name is created with the outer template.
Within the inner cookiecutter.json I define (among other things) analysis_name. I would then like to run
cd repo_name
cookiecutter project_template
so that a folder called repo_name/analysis_name is created with inner template.
The issue I'm running into is that on the outer cookiecutter creation it's failing to find the inner cookiecutter attribute analysis_name:
Error message: 'collections.OrderedDict object' has no attribute 'analysis_name'.
Is there any way I can achieve this nested cookiecutter functionality?
I think i figured it out, and it was very simple. The "copy without render" flag in cookiecutter.json (see docs) allows me to avoid rendering the inner template: