400 Commits

Author SHA1 Message Date
Mend Renovate
7dc2fedfdd
build(deps): update dependency ruff to v0.11.6 2025-04-24 15:39:55 +02:00
Sigurd Spieckermann
2491c0681b refactor: re-expose API with deprecation warnings on non-public API imports 2025-04-22 13:52:51 +02:00
Sigurd Spieckermann
ef5ea4b212 refactor: rename internal modules with a _ prefix 2025-04-22 13:52:51 +02:00
Sigurd Spieckermann
b42a032f7b style: fix formatter and linter errors 2025-04-22 12:20:23 +02:00
Sigurd Spieckermann
f374fd9baa build: migrate from Poetry to uv 2025-04-22 12:20:23 +02:00
Tsvika Shapira
a812e14033
feat: raise new TaskError exception on task errors
Raising `TaskError` instead of `subprocess.CalledProcessError` is backwards compatible, as `TaskError` is a subclass of `subprocess.CalledProcessError`.
2025-04-21 15:13:58 +02:00
roteiro
465a463ec4
fix(settings): use <CONFIG_ROOT>/copier as settings directory on Windows (#2071)
Deprecate `<CONFIG_ROOT>/copier/copier` and prefer  `<CONFIG_ROOT>/copier` as the settings directory for consistency across operating systems.
2025-04-17 22:05:59 +02:00
Sigurd Spieckermann
b078959972 fix(updating): ignore last answer of when: false questions
A recorded answer may exist when the question's `when` value gets switched from `when: true` to `when: false`, e.g. when the value is templated or changes across Copier template versions.
2025-04-03 06:40:19 +02:00
Sigurd Spieckermann
abd5d574e3 feat: raise InteractiveSessionError when prompting in non-interactive environment 2025-03-14 11:13:48 +01:00
Sigurd Spieckermann
8815034a93 fix: restore access to full rendering context in prompt phase 2025-03-11 14:17:30 +01:00
David Linke
ca764db9c6
fix: explicitly specify file encoding for windows (#2007)
* Test for #2006; conflict in unicode content on windows

* Read files in binary mode to avoid encoding problems
2025-03-09 21:12:41 +00:00
jeanluc
55d31e01c2
feat: Add _copier_operation variable (#1733)
* Makes `exclude` configuration templatable.
* Adds a `_copier_operation` variable to the rendering contexts for `exclude` and `tasks`, representing the current operation - either `copy`~~, `recopy`~~ or `update`.

This was proposed here: https://github.com/copier-org/copier/issues/1718#issuecomment-2282643624
2025-03-09 20:37:12 +00:00
Sigurd Spieckermann
ede686561d test: use helper function to load answers file data 2025-03-07 12:21:36 +01:00
Sigurd Spieckermann
d01c2e4b09 fix: auto-detect encoding when reading external data file 2025-03-05 19:02:01 +01:00
Sigurd Spieckermann
5c1a35749d fix(settings): auto-detect encoding when reading settings file 2025-03-05 19:01:43 +01:00
Axel H.
33485117f5 test(migrations): use the new migration format in the test to avoid warnings 2025-03-03 14:37:27 +01:00
Axel H.
4398010c60 test(migrations): add missing deprecation warnings assertions 2025-03-03 14:37:27 +01:00
Axel H.
c46c599c00 test(warnings): assert FutureWarnings are raised 2025-03-03 14:37:27 +01:00
Axel H.
05323404c2 test(warnings): assert OldTemplateWarnings are raised 2025-03-03 14:37:27 +01:00
Axel H.
1dabe8eb1e
feat(context): expose a _copier_phase context variable 2025-03-02 16:40:57 +01:00
Iwasa Kazmi
8b0ff719c7
fix(cli): auto-detect encoding when reading unicode-encoded file specified with --data-file 2025-03-02 13:16:52 +00:00
Sigurd Spieckermann
3daa5bc89c fix: expose only answers in question rendering context 2025-02-28 16:41:40 +01:00
danieleades
1c2f8d8b08
style: use pathlib 2025-02-26 17:42:21 +01:00
Chris Brown
44e67289c8
fix: ignore $file if $file.tmpl exists when subdirectory is used 2025-02-26 17:20:02 +01:00
Sigurd Spieckermann
3953603c40 fix: decode external data file content explicitly as UTF-8 2025-02-18 14:52:48 +01:00
Sigurd Spieckermann
21b486ce75 fix: decode answers file content explicitly as UTF-8 2025-02-17 15:49:50 +01:00
Jairo Llopis
25bc06d01d feat(external_data): load data from other YAML files
When composing templates, it's often needed to be able to load answers from other templates that you know are usually combined with yours. Or any other kind of external data.

@moduon MT-8282
2025-02-16 08:00:21 +00:00
Axel H.
71358ed397 feat(settings): allow to define some trusted repositories or prefixes 2025-01-29 19:46:06 +01:00
Axel H.
0a9644d249 feat(settings): add user settings support with defaults values (fix #235) 2025-01-29 19:46:06 +01:00
Kj
557c0d6144
feat: add dynamic file structures in loop using yield-tag (#1855)
Add jinja2 extension for yield tag, allow _render_path to generate multiple paths and contexts when yield tag is used.

The tag is only allowed in path render contexts. When rendering within a file, it doesn't make sense. Use the normal for tag there. If you use yield, you'll get an exception.

Fixes https://github.com/copier-org/copier/issues/1271
2025-01-18 08:24:32 +00:00
Don
9ccabd4f12
fix(updating): don't crash when file is removed from template's .gitignore file (#1886) 2024-12-21 22:24:08 +01:00
Jairo Llopis
fd23923b5c
style(ruff-format): enable and reformat Python files
Until now, only linting was enabled. My failure.

I added this setting to widen the code style automation. I also enabled [keep-runtime-typing](https://docs.astral.sh/ruff/settings/#lint_pyupgrade_keep-runtime-typing) because we use Pydantic.

Finally, I executed the new formatting over all the project.
2024-12-03 13:59:00 +01:00
Sigurd Spieckermann
50af2585b5 fix: re-render answers file path when producing render context 2024-10-29 14:30:15 +01:00
Sigurd Spieckermann
89ecc2fd2b test: add test case for updating a Git submodule 2024-10-25 11:16:58 +02:00
Sigurd Spieckermann
b2f584d1a4 fix(updating): don't validate computed values 2024-10-21 19:29:35 +02:00
Timothée Mazzucotelli
f1cb4a2c9c
fix: Don't mark files without conflict markers as unmerged (#1813)
Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
2024-10-19 08:51:42 +01:00
Sigurd Spieckermann
b5ef194328 feat: add support for dynamic choices 2024-10-18 19:41:34 +01:00
Tom C (DLS)
558f51cda7
fix: restore support for preserve_symlinks: false for directories (#1820) 2024-10-16 18:42:45 +02:00
Sigurd Spieckermann
34bde5aba1 fix(exclude): support negative exclude matching child of excluded parent 2024-10-15 06:43:56 +01:00
Sigurd Spieckermann
3c39738325 refactor: drop support for Python 3.8 2024-10-13 13:24:11 +01:00
Sigurd Spieckermann
04dc88165f fix: parse new answer when --skip-answered is used 2024-09-21 06:55:04 +01:00
Sigurd Spieckermann
2421d77e08 fix: validate answers to secret questions 2024-09-21 06:52:16 +01:00
Sigurd Spieckermann
9c1b86d4f9 perf(updating): avoid creating subproject copy 2024-08-29 19:49:02 +02:00
jeanluc
5ac93ee199
fix(updating): do not recreate deleted paths on update (#1719)
Previously, paths that matched a pattern in `skip_if_exists` and that were deleted in the generated project were recreated during each update. This was expected, because the file now didn't exist, and thus it's considered new. However, it might be surprising to some, so docs are updated and a test now makes that an officially supported use case.

For the rest of files, they shouldn't be recreated, even if the template changed. A user that deletes the file is kind of expressing their will to ignore that file from now on. To recover it, they can just recopy the template.

BREAKING CHANGE: If you delete a file in your subproject, it will not be recreated if it changes in the template and you update the subproject. Recopy if you need it back.
2024-08-17 08:44:09 +02:00
Sigurd Spieckermann
0258635da7 fix: support Git config without user identity 2024-07-30 13:40:17 +02:00
Arnau Buch
1035e94b94
fix: pass --skip-tasks flag to worker (#1688)
---------

Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
2024-07-03 13:27:29 +00:00
Jairo Llopis
217517802c fix(tasks): do not consider unsafe if they are being skipped
Fix https://github.com/copier-org/copier/issues/1598
2024-06-29 06:49:23 +01:00
Adrian Freund
d6f226f2b3
feat: add simpler migrations configuration syntax (#1510) 2024-05-15 11:19:11 +02:00
Andras Gefferth
10fbbccaa7
fix: do not overwrite identical files (#1576) 2024-04-21 11:54:45 +02:00
Sigurd Spieckermann
51fdd3b9a4 fix(updating): unset invalid last answers 2024-04-20 07:40:48 +01:00