copier-python 0.23.0__tar.gz → 0.24.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {copier_python-0.23.0 → copier_python-0.24.0}/PKG-INFO +1 -1
  2. {copier_python-0.23.0 → copier_python-0.24.0}/copier_python/update.py +18 -7
  3. copier_python-0.24.0/tests/template/__snapshots__/test_commit_check.ambr +55 -0
  4. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_contributing.ambr +68 -0
  5. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_commit_check.py +12 -6
  6. {copier_python-0.23.0 → copier_python-0.24.0}/tests/test_update.py +15 -6
  7. {copier_python-0.23.0 → copier_python-0.24.0}/.gitignore +0 -0
  8. {copier_python-0.23.0 → copier_python-0.24.0}/AGENTS.md +0 -0
  9. {copier_python-0.23.0 → copier_python-0.24.0}/CONTRIBUTING.md +0 -0
  10. {copier_python-0.23.0 → copier_python-0.24.0}/LICENSE +0 -0
  11. {copier_python-0.23.0 → copier_python-0.24.0}/README.md +0 -0
  12. {copier_python-0.23.0 → copier_python-0.24.0}/copier_python/__init__.py +0 -0
  13. {copier_python-0.23.0 → copier_python-0.24.0}/copier_python/__main__.py +0 -0
  14. {copier_python-0.23.0 → copier_python-0.24.0}/copier_python/py.typed +0 -0
  15. {copier_python-0.23.0 → copier_python-0.24.0}/copier_python/repo.py +0 -0
  16. {copier_python-0.23.0 → copier_python-0.24.0}/docs/contributing.md +0 -0
  17. {copier_python-0.23.0 → copier_python-0.24.0}/docs/development/requirements.md +0 -0
  18. {copier_python-0.23.0 → copier_python-0.24.0}/docs/development/updates.md +0 -0
  19. {copier_python-0.23.0 → copier_python-0.24.0}/docs/development/workflow.md +0 -0
  20. {copier_python-0.23.0 → copier_python-0.24.0}/docs/index.md +0 -0
  21. {copier_python-0.23.0 → copier_python-0.24.0}/docs/license.md +0 -0
  22. {copier_python-0.23.0 → copier_python-0.24.0}/docs/project-creation.md +0 -0
  23. {copier_python-0.23.0 → copier_python-0.24.0}/docs/project-development.md +0 -0
  24. {copier_python-0.23.0 → copier_python-0.24.0}/docs/project-release.md +0 -0
  25. {copier_python-0.23.0 → copier_python-0.24.0}/docs/project-setup.md +0 -0
  26. {copier_python-0.23.0 → copier_python-0.24.0}/docs/project-updates.md +0 -0
  27. {copier_python-0.23.0 → copier_python-0.24.0}/docs/releasing.md +0 -0
  28. {copier_python-0.23.0 → copier_python-0.24.0}/docs/requirements.md +0 -0
  29. {copier_python-0.23.0 → copier_python-0.24.0}/docs/setup.md +0 -0
  30. {copier_python-0.23.0 → copier_python-0.24.0}/pyproject.toml +0 -0
  31. {copier_python-0.23.0 → copier_python-0.24.0}/tests/__init__.py +0 -0
  32. {copier_python-0.23.0 → copier_python-0.24.0}/tests/conftest.py +0 -0
  33. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__init__.py +0 -0
  34. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_agents.ambr +0 -0
  35. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_compose.ambr +0 -0
  36. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_dockerfile.ambr +0 -0
  37. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_docs.ambr +0 -0
  38. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_license.ambr +0 -0
  39. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_mise_toml.ambr +0 -0
  40. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_pre_commit.ambr +0 -0
  41. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_pyproject.ambr +0 -0
  42. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_readme.ambr +0 -0
  43. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_workflows.ambr +0 -0
  44. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/__snapshots__/test_zensical.ambr +0 -0
  45. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_agents.py +0 -0
  46. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_compose.py +0 -0
  47. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_contributing.py +0 -0
  48. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_dockerfile.py +0 -0
  49. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_docs.py +0 -0
  50. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_license.py +0 -0
  51. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_mise_toml.py +0 -0
  52. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_pre_commit.py +0 -0
  53. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_pyproject.py +0 -0
  54. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_readme.py +0 -0
  55. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_structure.py +0 -0
  56. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_template.py +0 -0
  57. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_workflows.py +0 -0
  58. {copier_python-0.23.0 → copier_python-0.24.0}/tests/template/test_zensical.py +0 -0
  59. {copier_python-0.23.0 → copier_python-0.24.0}/tests/test_version.py +0 -0
  60. {copier_python-0.23.0 → copier_python-0.24.0}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: copier-python
3
- Version: 0.23.0
3
+ Version: 0.24.0
4
4
  Summary: Copier template for Python projects with modern tooling
5
5
  Project-URL: Homepage, https://smkent.github.io/copier-python
6
6
  Project-URL: Repository, https://github.com/smkent/copier-python
@@ -3,12 +3,15 @@ from __future__ import annotations
3
3
  import json
4
4
  import os
5
5
  import subprocess
6
+ from contextlib import contextmanager
6
7
  from dataclasses import dataclass, field
7
8
  from typing import TYPE_CHECKING
8
9
 
9
10
  from .repo import RepoWorktree
10
11
 
11
12
  if TYPE_CHECKING:
13
+ from collections.abc import Generator
14
+
12
15
  from .repo import RepoTarget
13
16
 
14
17
  TEMPLATE_REPO_URL = "https://github.com/smkent/copier-python"
@@ -25,6 +28,18 @@ class UpdateAction:
25
28
  with RepoWorktree.clone(self.repo, branch=self.branch) as worktree:
26
29
  return self._run(worktree)
27
30
 
31
+ @contextmanager
32
+ def _success_or_shell(
33
+ self, repo: RepoWorktree, name: str
34
+ ) -> Generator[None]:
35
+ try:
36
+ yield
37
+ except subprocess.CalledProcessError:
38
+ print( # noqa: T201
39
+ f"{name} failed. Fix errors and exit the shell to continue."
40
+ )
41
+ repo.shell()
42
+
28
43
  def _run(self, repo: RepoWorktree) -> str | None:
29
44
  """Run copier update in the repo worktree."""
30
45
  copier_status = json.loads(
@@ -38,7 +53,6 @@ class UpdateAction:
38
53
  if not copier_status.get("update_available", False):
39
54
  return None
40
55
  repo.run(["copier", "update", "--skip-answered", "--vcs-ref", end_ref])
41
- repo.run(["mise", "install"])
42
56
 
43
57
  status = repo.git_status()
44
58
  if not status:
@@ -54,13 +68,10 @@ class UpdateAction:
54
68
  if repo.has_conflicts(status):
55
69
  raise RuntimeError("Conflicts remain, aborting")
56
70
 
57
- try:
71
+ with self._success_or_shell(repo, "`mise install`"):
72
+ repo.run(["mise", "install"])
73
+ with self._success_or_shell(repo, "Lint/test"):
58
74
  repo.run_task("lt")
59
- except subprocess.CalledProcessError:
60
- print( # noqa: T201
61
- "Lint/test failed. Fix errors and exit the shell to continue."
62
- )
63
- repo.shell()
64
75
 
65
76
  title = "Apply template updates"
66
77
  body = ""
@@ -0,0 +1,55 @@
1
+ # serializer version: 1
2
+ # name: test_commit_check_config[private-commit-check.toml-accepted-with-disclosure]
3
+ '''
4
+ [commit]
5
+ conventional_commits = false
6
+ subject_max_length = 72
7
+ subject_min_length = 1
8
+ # Reject LLM session URL trailers and promotional "Generated with" lines
9
+ message_pattern = '(?ims)(?!.*^(?:[\w-]+-session:\s|\W*generated (?:with|by) \S))'
10
+ ai_attribution = "disclose"
11
+ ai_disclosure_trailers = ["Assisted-by"]
12
+ # Assisted-by: values must not be email addresses or URLs
13
+ ai_disclosure_pattern = '^(?!.*(@|://)).*\S'
14
+
15
+ '''
16
+ # ---
17
+ # name: test_commit_check_config[private-commit-check.toml-not-accepted]
18
+ '''
19
+ [commit]
20
+ conventional_commits = false
21
+ subject_max_length = 72
22
+ subject_min_length = 1
23
+ # Reject LLM session URL trailers and promotional "Generated with" lines
24
+ message_pattern = '(?ims)(?!.*^(?:[\w-]+-session:\s|\W*generated (?:with|by) \S))'
25
+ ai_attribution = "forbid"
26
+
27
+ '''
28
+ # ---
29
+ # name: test_commit_check_config[public-.github/commit-check.toml-accepted-with-disclosure]
30
+ '''
31
+ [commit]
32
+ conventional_commits = false
33
+ subject_max_length = 72
34
+ subject_min_length = 1
35
+ # Reject LLM session URL trailers and promotional "Generated with" lines
36
+ message_pattern = '(?ims)(?!.*^(?:[\w-]+-session:\s|\W*generated (?:with|by) \S))'
37
+ ai_attribution = "disclose"
38
+ ai_disclosure_trailers = ["Assisted-by"]
39
+ # Assisted-by: values must not be email addresses or URLs
40
+ ai_disclosure_pattern = '^(?!.*(@|://)).*\S'
41
+
42
+ '''
43
+ # ---
44
+ # name: test_commit_check_config[public-.github/commit-check.toml-not-accepted]
45
+ '''
46
+ [commit]
47
+ conventional_commits = false
48
+ subject_max_length = 72
49
+ subject_min_length = 1
50
+ # Reject LLM session URL trailers and promotional "Generated with" lines
51
+ message_pattern = '(?ims)(?!.*^(?:[\w-]+-session:\s|\W*generated (?:with|by) \S))'
52
+ ai_attribution = "forbid"
53
+
54
+ '''
55
+ # ---
@@ -183,12 +183,16 @@
183
183
  A contributor is always the author of their contributions.
184
184
  You must read, review, and understand everything you submit, including
185
185
  LLM-generated code or text, and be able to explain it on request.
186
+ Contributions must be submitted by a person, not autonomously by a bot or
187
+ LLM agent.
186
188
 
187
189
  If a commit contains code or text largely generated by an LLM, add an
188
190
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
189
191
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
190
192
 
191
193
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
194
+ Do not include LLM session URLs, or promotional lines such as
195
+ "Generated with [...]."
192
196
 
193
197
  '''
194
198
  # ---
@@ -221,12 +225,16 @@
221
225
  A contributor is always the author of their contributions.
222
226
  You must read, review, and understand everything you submit, including
223
227
  LLM-generated code or text, and be able to explain it on request.
228
+ Contributions must be submitted by a person, not autonomously by a bot or
229
+ LLM agent.
224
230
 
225
231
  If a commit contains code or text largely generated by an LLM, add an
226
232
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
227
233
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
228
234
 
229
235
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
236
+ Do not include LLM session URLs, or promotional lines such as
237
+ "Generated with [...]."
230
238
 
231
239
  ## Development documentation
232
240
 
@@ -350,6 +358,10 @@
350
358
  work. However, code and text you submit must be authored by you, not generated
351
359
  by an LLM.
352
360
 
361
+ Commits with LLM attribution are rejected. This includes `Assisted-by:` or
362
+ `Co-authored-by:` trailers, LLM session URLs, and promotional lines such as
363
+ "Generated with [...]".
364
+
353
365
  '''
354
366
  # ---
355
367
  # name: test_contributing_features[not-accepted-no_docs]
@@ -383,6 +395,10 @@
383
395
  work. However, code and text you submit must be authored by you, not generated
384
396
  by an LLM.
385
397
 
398
+ Commits with LLM attribution are rejected. This includes `Assisted-by:` or
399
+ `Co-authored-by:` trailers, LLM session URLs, and promotional lines such as
400
+ "Generated with [...]".
401
+
386
402
  ## Development documentation
387
403
 
388
404
  ### Prerequisites
@@ -503,12 +519,16 @@
503
519
  A contributor is always the author of their contributions.
504
520
  You must read, review, and understand everything you submit, including
505
521
  LLM-generated code or text, and be able to explain it on request.
522
+ Contributions must be submitted by a person, not autonomously by a bot or
523
+ LLM agent.
506
524
 
507
525
  If a commit contains code or text largely generated by an LLM, add an
508
526
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
509
527
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
510
528
 
511
529
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
530
+ Do not include LLM session URLs, or promotional lines such as
531
+ "Generated with [...]."
512
532
 
513
533
  '''
514
534
  # ---
@@ -543,12 +563,16 @@
543
563
  A contributor is always the author of their contributions.
544
564
  You must read, review, and understand everything you submit, including
545
565
  LLM-generated code or text, and be able to explain it on request.
566
+ Contributions must be submitted by a person, not autonomously by a bot or
567
+ LLM agent.
546
568
 
547
569
  If a commit contains code or text largely generated by an LLM, add an
548
570
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
549
571
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
550
572
 
551
573
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
574
+ Do not include LLM session URLs, or promotional lines such as
575
+ "Generated with [...]."
552
576
 
553
577
  '''
554
578
  # ---
@@ -583,12 +607,16 @@
583
607
  A contributor is always the author of their contributions.
584
608
  You must read, review, and understand everything you submit, including
585
609
  LLM-generated code or text, and be able to explain it on request.
610
+ Contributions must be submitted by a person, not autonomously by a bot or
611
+ LLM agent.
586
612
 
587
613
  If a commit contains code or text largely generated by an LLM, add an
588
614
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
589
615
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
590
616
 
591
617
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
618
+ Do not include LLM session URLs, or promotional lines such as
619
+ "Generated with [...]."
592
620
 
593
621
  '''
594
622
  # ---
@@ -623,12 +651,16 @@
623
651
  A contributor is always the author of their contributions.
624
652
  You must read, review, and understand everything you submit, including
625
653
  LLM-generated code or text, and be able to explain it on request.
654
+ Contributions must be submitted by a person, not autonomously by a bot or
655
+ LLM agent.
626
656
 
627
657
  If a commit contains code or text largely generated by an LLM, add an
628
658
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
629
659
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
630
660
 
631
661
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
662
+ Do not include LLM session URLs, or promotional lines such as
663
+ "Generated with [...]."
632
664
 
633
665
  '''
634
666
  # ---
@@ -663,12 +695,16 @@
663
695
  A contributor is always the author of their contributions.
664
696
  You must read, review, and understand everything you submit, including
665
697
  LLM-generated code or text, and be able to explain it on request.
698
+ Contributions must be submitted by a person, not autonomously by a bot or
699
+ LLM agent.
666
700
 
667
701
  If a commit contains code or text largely generated by an LLM, add an
668
702
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
669
703
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
670
704
 
671
705
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
706
+ Do not include LLM session URLs, or promotional lines such as
707
+ "Generated with [...]."
672
708
 
673
709
  '''
674
710
  # ---
@@ -703,12 +739,16 @@
703
739
  A contributor is always the author of their contributions.
704
740
  You must read, review, and understand everything you submit, including
705
741
  LLM-generated code or text, and be able to explain it on request.
742
+ Contributions must be submitted by a person, not autonomously by a bot or
743
+ LLM agent.
706
744
 
707
745
  If a commit contains code or text largely generated by an LLM, add an
708
746
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
709
747
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
710
748
 
711
749
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
750
+ Do not include LLM session URLs, or promotional lines such as
751
+ "Generated with [...]."
712
752
 
713
753
  '''
714
754
  # ---
@@ -743,12 +783,16 @@
743
783
  A contributor is always the author of their contributions.
744
784
  You must read, review, and understand everything you submit, including
745
785
  LLM-generated code or text, and be able to explain it on request.
786
+ Contributions must be submitted by a person, not autonomously by a bot or
787
+ LLM agent.
746
788
 
747
789
  If a commit contains code or text largely generated by an LLM, add an
748
790
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
749
791
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
750
792
 
751
793
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
794
+ Do not include LLM session URLs, or promotional lines such as
795
+ "Generated with [...]."
752
796
 
753
797
  '''
754
798
  # ---
@@ -783,12 +827,16 @@
783
827
  A contributor is always the author of their contributions.
784
828
  You must read, review, and understand everything you submit, including
785
829
  LLM-generated code or text, and be able to explain it on request.
830
+ Contributions must be submitted by a person, not autonomously by a bot or
831
+ LLM agent.
786
832
 
787
833
  If a commit contains code or text largely generated by an LLM, add an
788
834
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
789
835
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
790
836
 
791
837
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
838
+ Do not include LLM session URLs, or promotional lines such as
839
+ "Generated with [...]."
792
840
 
793
841
  '''
794
842
  # ---
@@ -823,12 +871,16 @@
823
871
  A contributor is always the author of their contributions.
824
872
  You must read, review, and understand everything you submit, including
825
873
  LLM-generated code or text, and be able to explain it on request.
874
+ Contributions must be submitted by a person, not autonomously by a bot or
875
+ LLM agent.
826
876
 
827
877
  If a commit contains code or text largely generated by an LLM, add an
828
878
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
829
879
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
830
880
 
831
881
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
882
+ Do not include LLM session URLs, or promotional lines such as
883
+ "Generated with [...]."
832
884
 
833
885
  '''
834
886
  # ---
@@ -863,12 +915,16 @@
863
915
  A contributor is always the author of their contributions.
864
916
  You must read, review, and understand everything you submit, including
865
917
  LLM-generated code or text, and be able to explain it on request.
918
+ Contributions must be submitted by a person, not autonomously by a bot or
919
+ LLM agent.
866
920
 
867
921
  If a commit contains code or text largely generated by an LLM, add an
868
922
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
869
923
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
870
924
 
871
925
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
926
+ Do not include LLM session URLs, or promotional lines such as
927
+ "Generated with [...]."
872
928
 
873
929
  '''
874
930
  # ---
@@ -903,12 +959,16 @@
903
959
  A contributor is always the author of their contributions.
904
960
  You must read, review, and understand everything you submit, including
905
961
  LLM-generated code or text, and be able to explain it on request.
962
+ Contributions must be submitted by a person, not autonomously by a bot or
963
+ LLM agent.
906
964
 
907
965
  If a commit contains code or text largely generated by an LLM, add an
908
966
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
909
967
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
910
968
 
911
969
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
970
+ Do not include LLM session URLs, or promotional lines such as
971
+ "Generated with [...]."
912
972
 
913
973
  '''
914
974
  # ---
@@ -943,12 +1003,16 @@
943
1003
  A contributor is always the author of their contributions.
944
1004
  You must read, review, and understand everything you submit, including
945
1005
  LLM-generated code or text, and be able to explain it on request.
1006
+ Contributions must be submitted by a person, not autonomously by a bot or
1007
+ LLM agent.
946
1008
 
947
1009
  If a commit contains code or text largely generated by an LLM, add an
948
1010
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
949
1011
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
950
1012
 
951
1013
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
1014
+ Do not include LLM session URLs, or promotional lines such as
1015
+ "Generated with [...]."
952
1016
 
953
1017
  '''
954
1018
  # ---
@@ -983,12 +1047,16 @@
983
1047
  A contributor is always the author of their contributions.
984
1048
  You must read, review, and understand everything you submit, including
985
1049
  LLM-generated code or text, and be able to explain it on request.
1050
+ Contributions must be submitted by a person, not autonomously by a bot or
1051
+ LLM agent.
986
1052
 
987
1053
  If a commit contains code or text largely generated by an LLM, add an
988
1054
  `Assisted-by: <tool>:<model>` trailer to its message. This can be done
989
1055
  automatically with `git commit --trailer="Assisted-by: <tool>:<model>"`.
990
1056
 
991
1057
  Do not use `Co-authored-by:` for LLM attribution. LLMs are tools, not authors.
1058
+ Do not include LLM session URLs, or promotional lines such as
1059
+ "Generated with [...]."
992
1060
 
993
1061
  '''
994
1062
  # ---
@@ -4,13 +4,16 @@ from typing import TYPE_CHECKING
4
4
 
5
5
  import pytest
6
6
 
7
- from tests.utils import template
8
-
9
7
  if TYPE_CHECKING:
10
8
  from collections.abc import Callable
11
9
  from pathlib import Path
12
10
 
11
+ from syrupy.assertion import SnapshotAssertion
12
+
13
13
 
14
+ @pytest.mark.parametrize(
15
+ "llm_contribution_policy", ["accepted-with-disclosure", "not-accepted"]
16
+ )
14
17
  @pytest.mark.parametrize(
15
18
  ("project_visibility", "config_path"),
16
19
  [
@@ -20,10 +23,13 @@ if TYPE_CHECKING:
20
23
  )
21
24
  def test_commit_check_config(
22
25
  render_template: Callable[..., Path],
26
+ snapshot: SnapshotAssertion,
23
27
  project_visibility: str,
24
28
  config_path: str,
29
+ llm_contribution_policy: str,
25
30
  ) -> None:
26
- rendered = render_template(project_visibility=project_visibility)
27
- assert (rendered / config_path).read_text() == (
28
- template.dir / "includes" / "commit-check.toml"
29
- ).read_text()
31
+ rendered = render_template(
32
+ project_visibility=project_visibility,
33
+ llm_contribution_policy=llm_contribution_policy,
34
+ )
35
+ assert (rendered / config_path).read_text() == snapshot
@@ -18,6 +18,7 @@ import pytest
18
18
  import yaml
19
19
 
20
20
  from copier_python.__main__ import main, update
21
+ from tests.utils import template
21
22
 
22
23
  if TYPE_CHECKING:
23
24
  from collections.abc import Callable, Generator, Sequence
@@ -29,7 +30,7 @@ DEFAULT_BRANCH_NAME = "fhqwhgads"
29
30
  DEFAULT_END_REF = "v0.22.2"
30
31
 
31
32
 
32
- @pytest.fixture(params=["v0.16.0"])
33
+ @pytest.fixture(params=["v0.16.2"])
33
34
  def start_ref(request: pytest.FixtureRequest) -> str:
34
35
  return request.param
35
36
 
@@ -86,7 +87,7 @@ def create_project(
86
87
  postcreate: Callable[[Path], None] | None = None,
87
88
  **kwargs: Any,
88
89
  ) -> Path:
89
- project = render_template(vcs_ref=vcs_ref)
90
+ project = render_template(vcs_ref=vcs_ref, **kwargs)
90
91
  timestamp = _vcs_ref_timestamp(vcs_ref)
91
92
  for cmd in (
92
93
  ["git", "init", "-b", DEFAULT_BRANCH_NAME],
@@ -223,15 +224,19 @@ def test_main_help(monkeypatch: pytest.MonkeyPatch) -> None:
223
224
  main()
224
225
 
225
226
 
227
+ @pytest.mark.parametrize(
228
+ "project_visibility", template.choices.project_visibility
229
+ )
226
230
  def test_main_update_with_project_current(
227
231
  worktree: Path,
228
232
  expect_run: ExpectRun,
229
233
  create_project: Callable[..., Path],
234
+ project_visibility: str,
230
235
  end_ref: str,
231
236
  *,
232
237
  dry_run: bool,
233
238
  ) -> None:
234
- create_project(vcs_ref=end_ref)
239
+ create_project(vcs_ref=end_ref, project_visibility=project_visibility)
235
240
  expect_run.expect(
236
241
  ["git", "clone", "https://github.com/ness/pkfire", str(worktree)]
237
242
  )
@@ -316,7 +321,6 @@ def test_main_update_error(
316
321
  ["copier", "update", "--skip-answered", "--vcs-ref", end_ref],
317
322
  cwd=worktree,
318
323
  )
319
- expect_run.expect(["mise", "install"], cwd=worktree)
320
324
  expect_run.expect(
321
325
  ["git", "status", "--porcelain"], cwd=worktree, capture_output=True
322
326
  )
@@ -324,6 +328,7 @@ def test_main_update_error(
324
328
  expect_run.expect(
325
329
  ["git", "status", "--porcelain"], cwd=worktree, capture_output=True
326
330
  )
331
+ expect_run.expect(["mise", "install"], cwd=worktree)
327
332
  expect_run.expect(["mise", "run", "lt"], cwd=worktree)
328
333
  expect_run.expect([str(mock_shell)], cwd=worktree)
329
334
  for cmd in [
@@ -364,16 +369,20 @@ def test_main_update_repo_arguments(
364
369
  update([arg], dry_run=True)
365
370
 
366
371
 
372
+ @pytest.mark.parametrize(
373
+ "project_visibility", template.choices.project_visibility
374
+ )
367
375
  def test_main_update_with_project(
368
376
  worktree: Path,
369
377
  expect_run: ExpectRun,
370
378
  create_project: Callable[..., Path],
379
+ project_visibility: str,
371
380
  end_ref: str,
372
381
  start_ref: str,
373
382
  *,
374
383
  dry_run: bool,
375
384
  ) -> None:
376
- create_project(vcs_ref=start_ref)
385
+ create_project(vcs_ref=start_ref, project_visibility=project_visibility)
377
386
  commit_message = os.linesep.join(
378
387
  (
379
388
  "Apply template updates",
@@ -407,10 +416,10 @@ def test_main_update_with_project(
407
416
  ["copier", "update", "--skip-answered", "--vcs-ref", end_ref],
408
417
  cwd=worktree,
409
418
  )
410
- expect_run.expect(["mise", "install"], cwd=worktree)
411
419
  expect_run.expect(
412
420
  ["git", "status", "--porcelain"], cwd=worktree, capture_output=True
413
421
  )
422
+ expect_run.expect(["mise", "install"], cwd=worktree)
414
423
  for cmd in [
415
424
  [*["mise", "run", "lt"]],
416
425
  [*["git", "add", "-A"]],
File without changes
File without changes
File without changes