question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cookiecutter-2.1.1 breaks cruft

See original GitHub issue

After recent upgrade I get

➜ cruft update --allow-untracked-files --skip-apply-ask --cookiecutter-input
Traceback (most recent call last):
  File "/Users/justin/.pyenv/versions/dev/bin/cruft", line 8, in <module>
    sys.exit(app())
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_cli.py", line 237, in update
    if not _commands.update(
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/utils/__init__.py", line 14, in wrapper
    return f(*args, **kwargs)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/utils/__init__.py", line 14, in wrapper
    return f(*args, **kwargs)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/update.py", line 63, in update
    _ = utils.generate.cookiecutter_template(
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/utils/generate.py", line 40, in cookiecutter_template
    context = _generate_output(cruft_state, Path(repo.working_dir), cookiecutter_input, output_dir)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/utils/generate.py", line 65, in _generate_output
    new_context = generate_cookiecutter_context(
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cruft/_commands/utils/cookiecutter.py", line 90, in generate_cookiecutter_context
    context = generate_context(
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cookiecutter/generate.py", line 118, in generate_context
    apply_overwrites_to_context(obj, extra_context)
  File "/Users/justin/.pyenv/versions/dev/lib/python3.10/site-packages/cookiecutter/generate.py", line 68, in apply_overwrites_to_context
    raise ValueError(
ValueError: ['.pre-commit-config.yaml', 'cookiecutter.json', 'hooks', 'template', '{{ cookiecutter.github_repo }}'] provided for choice variable _copy_without_render, but the choices are ['.pre-commit-config.yaml', 'cookiecutter.json', 'hooks', 'template', '{{ cookiecutter.github_repo }}'].

Downgrading to cookiecutter-1.7.3 fixes the problem.

What additional information do you need?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
simonwardjonescommented, Aug 1, 2022

I am having this problem too. I think the apply_overwrites_to_context function within cookiecutter is assuming that the overwrite variable is never also a list. I think this will need to be fixed on the cookiecutter side so that in the case when the overwrite is also a list it just overwrites.

1reaction
jslorrmacommented, Dec 9, 2022

Hello cruft-team …

I really like your project. I was halfway in implementing something like cruft on my own when I found this. It’s really great work and saves me a lot of time. Thanks for that … 👍👍

In one of my cookiecutter templates I’m using '_extensions' and see a similar error as reported here.

cookiecutter.json: { “project_name”: “The name of the python library”, … “_extensions”: [“jinja2_time.TimeExtension”], }

error:

ValueError: ['jinja2_time.TimeExtension'] provided for choice variable _extensions, but the choices are ['jinja2_time.TimeExtension'].

Any update on #197? Tested the fix provided in #197 locally. It solves my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cool In The Tropics Cookie Cutter 2 Pc Set – Flamingo ...
Cool In The Tropics Cookie Cutter 2 Pc Set – Flamingo, Pineapple Cookie Cutters Hand Made in the USA from ... Package Dimensions,...
Read more >
Bunny Face Embosser - N3 Two pc set - Etsy
1x ear pc that is approx 1.1in high x .38in wide - this can be use ... Bunny Face Cookie Cutter 2-Piece, Stamp...
Read more >
BABY FEET | COOKIE CUTTER | 2 PIECES
Quantity Breaks. 1-11. $4.40. 12+. $3.08. Quantity: Add to Favourites. 5 Stars 4 Stars 3 Stars 2 Stars 1 Star. (0 reviews) ·...
Read more >
Moon Cat Cookie Cutter - Cults 3D
... Cookie Cutter - 2 designs included・3D. Dachshund Cookie Cutter - 2 designs included. US$0.53 ... Beautifully Broken Flowerpot. US$1.50.
Read more >
The American Ethnic Cookbook For Students - EPDF
... to eat something that would normally break a food rule of their own group. ... slotted spoon 1.1 Ialvc, peel, and chop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found