Skip to content

v9.6.0 no longer supports using _copier_conf in questions #2021

@TimMonko

Description

@TimMonko

Describe the problem

This morning, a user of napari-plugin-template reported an issue where _copier_conf is undefined when trying to copy our template.

Our template uses _copier_conf.dst_path | basename for a default value. This works on 9.5.0 but not 9.6.0. I'm not seeing this as an intentional change in the release notes.

I can put debugging in the _message_before_copy and see that _copier_conf is defined, but it does not seem to be defined in the questions:

_message_before_copy: |
    ...
    DEBUG INFO:
    _defined: {{ 'defined' if _copier_conf is defined  }}
    _copier_conf: {{ _copier_conf.keys() | list if _copier_conf is defined else 'undefined' }}
    _basename: {{ _copier_conf.dst_path | basename }}

plugin_name:
    default: "{{ _copier_conf.dst_path | basename if _copier_conf is defined else 'napari-plugin' }}"
    help: The name of your plugin, used to name the package and repository
    type: str
    validator: >-
        {% if not (plugin_name | regex_search('^[a-z][a-z0-9\-]+$')) %}
        plugin_name must be lowercase, no spaces, and may contain hyphens.
        {% endif %}

Template

https://github.com/napari/napari-plugin-template

To Reproduce

copier copy --trust https://github.com/napari/napari-plugin-template plugin-test

Logs

copier copy --trust https://github.com/napari/napari-plugin-template plugin-test
No git tags found in template; using HEAD as ref

Welcome to the napari plugin template!
This template will help you create a new napari plugin with all the necessary structure of a Python package.

For more detailed information about each prompt, see:
https://github.com/napari/napari-plugin-template/blob/main/PROMPTS.md

'_copier_conf' is undefined

Expected behavior

_copier_conf is defined in the question portion of the template

Screenshots/screencasts/logs

No response

Operating system

Windows

Operating system distribution and version

Windows 11

Copier version

9.6.0

Python version

3.12

Installation method

pip+pypi

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageTrying to make sure if this is valid or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions