Add ability to pass in a context file#116
Conversation
If cookiecutter is used inside of a project creation automation, you want to not only give --no-input, but also supply input values other than the ones in the default file. Add a command line option, --context-file, which allows overriding the default location for default values.
There was a problem hiding this comment.
Missing a trailing ,.
Which fixes the build failure: https://travis-ci.org/audreyr/cookiecutter/jobs/13916746
|
Could we please change this a bit, I think it's cleaner for |
|
Ah, that's #75. |
|
@emonty thanks for submitting, and @michaeljoseph thanks for all your help. Yeah, something along these lines would probably good. Sigh, I need to squeeze out some time to study #75 and #100 and figure out what to do - work, the upcoming book, and wedding planning pressure are just killing me right now. @michaeljoseph any thoughts about one vs the other? |
|
@audreyr #75 is solid, has tests and just updates the internal cookiecutter API to take a context dict (which is what I care about for michaeljoseph/changes#35 and is the simplest change). Ok, so I think 👍 for #75 and #116 and then a re-work of #100 to support the user config bypass case? |
|
@emonty 🔔 |
|
I forked this repo specifically to add this feature then found it sitting here moribund. What is the status? Can I help? |
|
@shaleh @emonty I apologize for the delay, my fault. I just added @michaeljoseph and @pydanny as core committers and we're going to get through the backlog. I'm marking this for 0.8.0 for now since #75 is marked as 0.8.0. @michaeljoseph you know the most about this area, so I'll let you take the lead on merging as per your earlier comments. @pydanny Before @michaeljoseph merges this for 0.8.0, will you have time to work on a 0.7.2 patch release for fixing the Windows tests? Or should we do 0.8.0 this week-ish and the Windows tests in an 0.8.1 patch next week? |
|
No worries @audreyr. I went through and commented on a few open tickets today. The team can ping me for input or testing. |
|
@audreyr Unless I get a Windows expert to help out, I simply can't predict when the tests on Windows will be fixed. Therefore, I recommend:
|
|
This is very similar to Issue #187 and Issue #199; however the behaviors are slightly different. In this case, --context-file overrides the values in cookiecutter.json which then can be overridden by values in default_context. cookiecutter.json <= context_file < default_context. The most truthy values are in default_context. I'm not sure that is what we want. Projects like Ansible have the command-line parameters be the most truthy values overriding all other paths. The #199 case, --parameters applies the user parameters after default_context. It also enforces cookiecutter.json has the truth regarding the keys for the project. This is important if the template changes the variable definitions, in which case an out-of-date parameters.json file will throw an error. cookiecutter.json < default_context < user_parameters |
|
👀 #260 |
If cookiecutter is used inside of a project creation automation, you
want to not only give --no-input, but also supply input values other
than the ones in the default file.
Add a command line option, --context-file, which allows overriding the
default location for default values.