copier-python 0.20.1__py3-none-any.whl → 0.22.0__py3-none-any.whl

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.
copier_python/__main__.py CHANGED
@@ -73,6 +73,9 @@ class UpdateResult:
73
73
  def update(
74
74
  repos: Args.Repos,
75
75
  *,
76
+ vcs_ref: Annotated[
77
+ str | None, Option("--vcs-ref", "-r", help="Template ref to update to")
78
+ ] = None,
76
79
  dry_run: Args.DryRun = False,
77
80
  branch: Annotated[str, Option(help="Branch name to create.")] = "updates",
78
81
  ) -> None:
@@ -82,14 +85,16 @@ def update(
82
85
  repo_targets = {(target := RepoTarget(repo)).url: target for repo in repos}
83
86
  for target in repo_targets.values():
84
87
  try:
85
- pr_url = UpdateAction(target, branch=branch, dry_run=dry_run)()
88
+ pr_url = UpdateAction(
89
+ target, branch=branch, vcs_ref=vcs_ref, dry_run=dry_run
90
+ )()
86
91
  if pr_url:
87
92
  results.append(
88
93
  UpdateResult(target, UpdateStatus.UPDATED, pr_url=pr_url)
89
94
  )
90
95
  else:
91
96
  results.append(UpdateResult(target, UpdateStatus.CURRENT))
92
- except Exception as exc: # noqa: BLE001, PERF203
97
+ except Exception as exc: # noqa: BLE001
93
98
  console.print_exception()
94
99
  results.append(
95
100
  UpdateResult(target, status=UpdateStatus.FAILED, exception=exc)
copier_python/repo.py CHANGED
@@ -3,24 +3,18 @@ from __future__ import annotations
3
3
  import os
4
4
  import re
5
5
  import subprocess
6
- import sys
7
6
  import tempfile
8
7
  from contextlib import contextmanager, suppress
9
8
  from dataclasses import InitVar, dataclass, field
10
9
  from functools import cached_property
11
10
  from pathlib import Path
12
- from typing import TYPE_CHECKING, Any, ClassVar
11
+ from typing import TYPE_CHECKING, Any, ClassVar, Self
13
12
 
14
13
  import yaml
15
14
  from rich import print # noqa: A004
16
15
  from rich.panel import Panel
17
16
  from rich.text import Text
18
17
 
19
- if sys.version_info >= (3, 11):
20
- from typing import Self
21
- else:
22
- from typing_extensions import Self
23
-
24
18
  if TYPE_CHECKING:
25
19
  from collections.abc import Generator, Sequence
26
20
 
copier_python/update.py CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import json
4
4
  import os
5
5
  import subprocess
6
- from dataclasses import dataclass
6
+ from dataclasses import dataclass, field
7
7
  from typing import TYPE_CHECKING
8
8
 
9
9
  from .repo import RepoWorktree
@@ -18,7 +18,8 @@ TEMPLATE_REPO_URL = "https://github.com/smkent/copier-python"
18
18
  class UpdateAction:
19
19
  repo: RepoTarget
20
20
  branch: str
21
- dry_run: bool = False
21
+ vcs_ref: str | None = None
22
+ dry_run: bool = field(default=False, kw_only=True)
22
23
 
23
24
  def __call__(self) -> str | None:
24
25
  with RepoWorktree.clone(self.repo, branch=self.branch) as worktree:
@@ -33,10 +34,11 @@ class UpdateAction:
33
34
  ).stdout.strip()
34
35
  )
35
36
  start_ref = "v" + copier_status["current_version"]
36
- end_ref = "v" + copier_status["latest_version"]
37
+ end_ref = self.vcs_ref or ("v" + copier_status["latest_version"])
37
38
  if not copier_status.get("update_available", False):
38
39
  return None
39
- repo.run(["copier", "update", "--skip-answered"])
40
+ repo.run(["copier", "update", "--skip-answered", "--vcs-ref", end_ref])
41
+ repo.run(["mise", "install"])
40
42
 
41
43
  status = repo.git_status()
42
44
  if not status:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: copier-python
3
- Version: 0.20.1
3
+ Version: 0.22.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
@@ -12,16 +12,16 @@ Classifier: Development Status :: 3 - Alpha
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
19
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
20
  Classifier: Topic :: Documentation
21
21
  Classifier: Topic :: Software Development
22
22
  Classifier: Topic :: Utilities
23
23
  Classifier: Typing :: Typed
24
- Requires-Python: >=3.10
24
+ Requires-Python: >=3.11
25
25
  Requires-Dist: pyyaml>=6
26
26
  Requires-Dist: rich>=15
27
27
  Requires-Dist: typer>=0.9
@@ -0,0 +1,10 @@
1
+ copier_python/__init__.py,sha256=FxuK5Dek123GsD9rxpsXCP4FjxI7unpoPYe6Mto1Rjk,289
2
+ copier_python/__main__.py,sha256=6flPTGOnGiXIoqzXatib9uuGLymA70BPYKWm4psBL84,3716
3
+ copier_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ copier_python/repo.py,sha256=Nv48fWeB0EZ4PGnrRWaiR6Fl5cyrD2_TwaJDcm-zNGE,5364
5
+ copier_python/update.py,sha256=Lr1VCoePjM3QECG7dmJynM3Rnz01bkew8f72mq0i9LE,2641
6
+ copier_python-0.22.0.dist-info/METADATA,sha256=pbrrPJaMTLGXFG0Lg08wpeXUFYh5p7WX2NfT8fNGtFc,5423
7
+ copier_python-0.22.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
8
+ copier_python-0.22.0.dist-info/entry_points.txt,sha256=HjthcI_ZBjVT8uC8vjlk8m4XWpmR9_b89rpAWjzFZvo,62
9
+ copier_python-0.22.0.dist-info/licenses/LICENSE,sha256=lwNXeTMjiyUh8CtIKWnb2SOTeliVKCJfs_NZB6P23BE,1086
10
+ copier_python-0.22.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- copier_python/__init__.py,sha256=FxuK5Dek123GsD9rxpsXCP4FjxI7unpoPYe6Mto1Rjk,289
2
- copier_python/__main__.py,sha256=DhAwkZmfhMa40m91IgDcVIDTjjaiT1hFHrZ7AqzJdVY,3560
3
- copier_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- copier_python/repo.py,sha256=1jYOAe9M8VPrdYFwk-wAX1IwK3xtuK4VsAHgXmj_cHQ,5475
5
- copier_python/update.py,sha256=_hRaIb2BLp59NLyGwzHrgv0RntE6QLyPcLbCipjIsMM,2496
6
- copier_python-0.20.1.dist-info/METADATA,sha256=s5YEEkH-ckCAeXjksPLKQlJElaOwx6zf-ALUXoMdmPU,5423
7
- copier_python-0.20.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
8
- copier_python-0.20.1.dist-info/entry_points.txt,sha256=HjthcI_ZBjVT8uC8vjlk8m4XWpmR9_b89rpAWjzFZvo,62
9
- copier_python-0.20.1.dist-info/licenses/LICENSE,sha256=lwNXeTMjiyUh8CtIKWnb2SOTeliVKCJfs_NZB6P23BE,1086
10
- copier_python-0.20.1.dist-info/RECORD,,