Open rvalyi opened 1 year ago
Thanks for pointing this. So the resolution is to go to v7. About the short version, I prefer to use the long version.
Hi, a related issue here, but with copier 9.2.0
. I want to use a git repo in Azure DevOps in a copier copy
command. Specifically I run:
copier copy https://dev.azure.com/
Traceback (most recent call last):
File "/Users/jdpg/.local/bin/copier", line 10, in <module>
sys.exit(copier_app_run())
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/plumbum/cli/application.py", line 638, in run
inst, retcode = subapp.run(argv, exit=False)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/plumbum/cli/application.py", line 633, in run
retcode = inst.main(*tailargs)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/cli.py", line 280, in main
return _handle_exceptions(inner)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/cli.py", line 70, in _handle_exceptions
method()
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/cli.py", line 271, in inner
with self._worker(
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/main.py", line 217, in __exit__
raise value
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/cli.py", line 278, in inner
worker.run_copy()
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/main.py", line 757, in run_copy
self._check_unsafe("copy")
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/main.py", line 231, in _check_unsafe
if self.template.jinja_extensions:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/template.py", line 326, in jinja_extensions
return tuple(self.config_data.get("jinja_extensions", ()))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/template.py", line 288, in config_data
result = filter_config(self._raw_config)[0]
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/template.py", line 245, in _raw_config
for p in self.local_abspath.glob("copier.*")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/functools.py", line 981, in __get__
val = self.func(instance)
File "/Users/jdpg/Library/Application Support/pipx/venvs/copier/lib/python3.10/site-packages/copier/template.py", line 500, in local_abspath
raise ValueError("Local template must be a directory.")
ValueError: Local template must be a directory.
It works fine with local folders, but not from Azure DevOps repos.
Any ideas? My computer can connect normally with git to that repo outside of copier
.
From the code it looks like a "git url" is required
class Template:
"""Object that represents a template and its current state.
See [configuring a template][configuring-a-template].
Attributes:
url:
Absolute origin that points to the template.
It can be:
- A local path.
- A Git url. Note: if something fails, prefix the URL with `git+`.
So, the solution that looks to work for me is the following:
from copier import run_copy
run_copy("git+https://dev.azure.com/.....", "folder")
Or, directly using the CLI:
copier copy git+https://dev.azure.com/... folder
From the code it looks like a "git url" is required
class Template: """Object that represents a template and its current state. See [configuring a template][configuring-a-template]. Attributes: url: Absolute origin that points to the template. It can be: - A local path. - A Git url. Note: if something fails, prefix the URL with `git+`.
So, the solution that looks to work for me is the following:
from copier import run_copy run_copy("git+https://dev.azure.com/.....", "folder")
Or, directly using the CLI:
copier copy git+https://dev.azure.com/... folder
Great, it indeed works with the git+
. Thanks!
For reference with copier 6.x if you do as in the README:
you will get:
if you upgrade to copier 7.x it works.
Alternatively you can bootstrap the project using this command instead:
May be we can change the readme to make it easier, not sure.