Conversation
Codecov Report
@@ Coverage Diff @@
## master #848 +/- ##
===========================================
- Coverage 100% 84.75% -15.25%
===========================================
Files 16 18 +2
Lines 657 807 +150
===========================================
+ Hits 657 684 +27
- Misses 0 123 +123
Continue to review full report at Codecov.
|
|
I would also like to hear from @freakboy3742 @jakubka and @zooba. Please feel free to comment on this proposal with regards to help messages and dict values. Thank you! 🙇 |
|
As I've already said in the chat, I really like this spec. For everyone having a hard time reading the json from the diff, this is the spec in a gist: https://gist.github.com/hackebrot/fc96363e6c4166c6b1bf0a31245669ee Could you maybe give an example on how exactly the |
|
@jayfk If I understood correctly, in the example: https://gist.github.com/hackebrot/fc96363e6c4166c6b1bf0a31245669ee#file-cookiecutter-json-L61-L79 1 - about 2 - What happens if 3 - Which will be used to indicate the version of the Anyway, after that first look, it sounds good to me. ps, I have not tested the code. I'll have time to test it next Saturday. |
That's important. We should make the version a requirement for the new format. |
| # mandatory fields | ||
| self.name = name | ||
| self.description = description | ||
| self.cookiecutter_version = cookiecutter_version |
There was a problem hiding this comment.
There is already a field called version, which refers to the template.
Meta InformationThere will be a number of fields that hold information about the template Required Fields for a Template
We can use this for dumping the JSON context for
This either indicators the version of cookiecutter that this template requires
The elements of this array represent a single variable, similarly to what you VariablesRequired Fields for a Variable
This is nothing different from what we have in the current
Again this is what we already have as values. If a default is a string, we must Optional Fields for a Variable
This defaults to
Currently we show
This can be used to hide prompts from a user if the template author wishes to
We can show this if the users runs verbose mode, to make it even clearer for
This would allow us to have some additional checks for accepting user input.
This is currently supported with lists in cookiecutter.json. However this
This one is a bit tricky. In it's current form it would be a string containing In this particular case, we ask the user if they want to create documentation. After having played with context formats for a good while, I don't think Optional Fields for a Template
This can be used for user facing aspects, like a welcome message when running
This will help us generate helpful error messages.
Again this will help users in case they encouter issues. Currently users tend
The template itself is not runnable software, but contains source code. So I
Providing keywords in a template makes it easier for tools, such as the new (For Cibopath I use all of the words on the README as keywords, which is not great 🙈 )
We can use this to point users to the project if they encounter an error. This |
|
I did some experiments with a standalone cookiecutter desktop gui application a while ago. The main idea is to have a little desktop app that can be used to browse available cookiecutter templates, fill out a form and render a template. This is an image from a protoype: In this context, it would make sense to add Is that something you would consider adding to the spec? |
|
I see a lot of things to like about the proposed format. A few things that I'd like to see (over)specified in any official spec:
@huguesv and @brettcannon may have more suggestions, but overall I like the direction this is going. |
|
I think this will solve all of my current wants. Using Otherwise I'm down to only wanting to inject the Jinja context into the pre- and post-generation scripts as a wishlist. Great work, @hackebrot ! |
|
Brett's "current wants" are for brettcannon/python-azure-web-app-cookiecutter, since he left that out (that's also a good example of the |
|
I like it too. Here are some of my thoughts that haven't been brought up already. It may be good to add examples of specifying Old format: For specifying extensions, it would be good to have the pip requirements there in addition to imported module, like @zooba idea for cookiecutter itself. This way we have the ability to prompt or automatically install any missing extension. I worry about localization more than most, and I wonder what that means for cookiecutter templates and Visual Studio. Most of Visual Studio is localized, and for cookiecutter GUI, does that mean localizing the prompts and descriptions in templates? What implications would this have on the json format? FYI I had filed my thoughts on what we could do a few weeks ago, based on the |
|
This is a huge, HUGE change to Cookiecutter. It's a huge amount of work for the maintainers, forcing a 2.0 release. This is the easy part, but the real work is the ongoing maintenance burden. We've got a lot of experience with handling that in Cookiecutter. Unless we have some sort of real sponsorship, be it financial compensation or an employer who will provide time, we should reconsider this change. Possibly reduce its scope or reject it. Otherwise we the maintainers of Cookiecutter will be doing a gigantic amount of unpaid labor. And that unpaid labor is more often than not, going to be for large well-funded organizations. Having done enough unpaid labor for such organizations (besides a token amount from Google), I'm hesitant to do any more. I know @hackebrot really wants to work on this effort, but I am putting it on hold for now. To identify this issue, I have put a "Requires Sponsorship" on this PR. If a well meaning organization wants to stand up and do the right thing, then I'll change it to a "Sponsored" PR label. And then we'll move forward on this change. |
|
I agree with what @pydanny said. While I can’t wait to implement and ship this exciting new feature, it is definitely going to increase the demand for maintenance, which inevitably eats up the team’s spare time. Unfortunately I can’t contribute to the project as part of my day job and neither Audrey, Danny, Michael or myself are paid to work on cookiecutter. Danny is right, we need an organization to commit to supporting this project. Everything else is unfair to the maintainers. 😞 |
|
Totally appreciate that, the last thing you guys want is to be a critical piece of infrastructure run entirely on volunteer time. Given my role at Microsoft, I can't actually offer any formal sponsorship (though I can - and will - raise the issue internally and see how far I get). We'll certainly have engineers around willing to help out on code/reviews/etc., but again, that's only an informal offer and if you guys need something really solid then that's probably not going to cut it. In any case, as great as this change is, we already have a workaround for now which we couldn't change for our upcoming release anyway. IIRC we capped our cookiecutter dependency at <1.5 to avoid unexpected breakage, so there's really no rush from our side to get to a new version. But we have already shown it to a few people around here and they love the concept, so if it takes off (i.e. lots of users, lots of templates, etc.) it'll be easier to come back with real support. Knowing that you're willing to accept and work with that is great. |
|
Will version 1.5 be released on PyPI before this PR is implemented? |
|
Any chance this will happen? |
|
@adamaltmejd #1008 has a fork implementing a version of this if you are feeling adventurous. You can always try the cookiecutter.js 😜 |
|
Hi! I am having a hard time understanding how to skip variables. For instance, with cookiecutter 1.6.0 , can somebody write a small simple example just showing, if I have in my cookiecutter.json only two variables: "prueba": [false, true], How can I make parameter only appear if prueba is true? Thanks a lot! |
|
What is the current state of this? It includes many interesting features that I need |
|
Let's do it 🚀 |
|
@hackebrot Are you happy to bring this branch up to date, or would you like someone else to take over? |
|
"Talk is cheap, show me the code", I know, but wouldn't it make sense to replace the format with TOML while at it? With this the old json format can be kept intact for backwards compatibility. |
|
I'm closing this PR because of its age. |

This is a proof-of-concept implementation for loading a new format for cookiecutter.json 😄
There are a number of features missing from this, but it should be sufficient to allow feedback on the specification. You can run the example via
$ python cookiecutter/context.py. Nothing will be generated, but the prompting is done (hardcoded to verbose) and the resulting context as an OrderedDict is pprinted.@audreyr @pydanny @michaeljoseph 👋
Please let me know your thoughts and I'll happily make changes to the spec.