-
-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Labels
Description
Describe the problem
v9.9.1 has broken a Github Action of mine that creates new PRs when template updates are found. v9.9.0 works just fine for me.
My copier.yaml file
mcp_server_name:
type: str
help: What is your MCP Server's name? Don't include the "mcp." prefix.
default: "{{ _copier_conf.dst_path.name[4:] if _copier_conf.dst_path.name.startswith('mcp.') else _copier_conf.dst_path.name }}"
validator: "{% if not mcp_server_name | regex_search('^[a-z0-9_-]+$') %}Server name must only contain lowercase letters, numbers, underscores, and dashes (no spaces or other special characters){% endif %}"
And I generate a .cursor/mcp.json.jinja
{
"mcpServers": {
"{{ mcp_server_name }}": {
"command": "uv",
"args": [
"--directory",
"/UPDATE/YOUR/ABSOLUTE/PATH/TO/mcp.{{ mcp_server_name }}",
"run",
"{{ mcp_server_name }}"
]
}
}
}
on ubuntu-latest, running copier update
produces the following error
Updating to template version 1.15.9
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.11/x64/bin/copier", line 7, in <module>
sys.exit(CopierApp.run())
^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/plumbum/cli/application.py", line 640, in run
inst, retcode = subapp.run(argv, exit=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/plumbum/cli/application.py", line 635, in run
retcode = inst.main(*tailargs)
^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_cli.py", line 428, in main
return _handle_exceptions(inner)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_cli.py", line 71, in _handle_exceptions
method()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_cli.py", line 418, in inner
with self._worker(
^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 272, in __exit__
raise value
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_cli.py", line 426, in inner
worker.run_update()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 96, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 1133, in run_update
self._apply_update()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 1157, in _apply_update
with replace(
^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 272, in __exit__
raise value
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 1173, in _apply_update
old_worker.run_copy()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 96, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 1048, in run_copy
self._render_template()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 734, in _render_template
self._render_file(src_relpath, dst_relpath, extra_context=ctx or {})
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/copier/_main.py", line 768, in _render_file
new_content = tpl.render(
^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
self.environment.handle_exception()
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/tmp/copier._vcs.clone.zlnf06g2/template/.cursor/mcp.json.jinja", line 7, in top-level template code
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/jinja2/sandbox.py", line 399, in call
if not __self.is_safe_callable(__obj):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/jinja2/sandbox.py", line 265, in is_safe_callable
getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'pathlib.PurePosixPath object' has no attribute 'absolute'
Error: Process completed with exit code 1.
This doesn't happen when I run update on a Mac. Any thoughts?
Template
n/a
To Reproduce
No response
Logs
Expected behavior
This error shouldn't happen
Screenshots/screencasts/logs
No response
Operating system
macOS
Operating system distribution and version
ubuntu-latest
Copier version
9.9.1
Python version
3.12
Installation method
pip+pypi
Additional context
No response