Skip to content

Commit 2780854

Browse files
committed
chore: Template upgrade
1 parent 596cf6d commit 2780854

6 files changed

Lines changed: 42 additions & 15 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.5.2
2+
_commit: 1.5.6
33
_src_path: gh:pawamoy/copier-uv
44
author_email: dev@pawamoy.fr
55
author_fullname: Timothée Mazzucotelli

docs/insiders/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ else:
6767
)
6868
```
6969

70+
Additionally, your sponsorship will give more weight to your upvotes on issues, helping us prioritize work items in our backlog. For more information on how we prioritize work, see this page: [Backlog management](https://pawamoy.github.io/backlog/).
71+
7072
## How to become a sponsor
7173

7274
Thanks for your interest in sponsoring! In order to become an eligible sponsor with your GitHub account, visit [pawamoy's sponsor profile][github sponsor profile], and complete a sponsorship of **$10 a month or more**. You can use your individual or organization GitHub account for sponsoring.

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ Funding = "https://github.com/sponsors/pawamoy"
5454
[project.scripts]
5555
griffe = "griffe:main"
5656

57-
[tool.pdm]
58-
version = {source = "scm"}
57+
[tool.pdm.version]
58+
source = "call"
59+
getter = "scripts.get_version:get_version"
5960

6061
[tool.pdm.build]
61-
package-dir = "src"
62-
editable-backend = "editables"
62+
# Include as much as possible in the source distribution, to help redistributors.
6363
excludes = ["**/.pytest_cache"]
6464
source-includes = [
6565
"config",
@@ -74,15 +74,15 @@ source-includes = [
7474
]
7575

7676
[tool.pdm.build.wheel-data]
77+
# Manual pages can be included in the wheel.
78+
# Depending on the installation tool, they will be accessible to users.
79+
# pipx supports it, uv does not yet, see https://github.com/astral-sh/uv/issues/4731.
7780
data = [
7881
{path = "share/**/*", relative-to = "."},
7982
]
8083

81-
[tool.uv]
82-
dev-dependencies = [
83-
# dev
84-
"editables>=0.5",
85-
84+
[dependency-groups]
85+
dev = [
8686
# maintenance
8787
"build>=1.2",
8888
"git-changelog>=2.5",

scripts/gen_credits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
pyproject = tomllib.load(pyproject_file)
2828
project = pyproject["project"]
2929
project_name = project["name"]
30-
devdeps = [dep for dep in pyproject["tool"]["uv"]["dev-dependencies"] if not dep.startswith("-e")]
30+
devdeps = [dep for dep in pyproject["dependency-groups"]["dev"] if not dep.startswith("-e")]
3131

3232
PackageMetadata = dict[str, Union[str, Iterable[str]]]
3333
Metadata = dict[str, PackageMetadata]

scripts/get_version.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Get current project version from Git tags or changelog."""
2+
3+
import re
4+
from contextlib import suppress
5+
from pathlib import Path
6+
7+
from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm
8+
9+
_root = Path(__file__).parent.parent
10+
_changelog = _root / "CHANGELOG.md"
11+
_changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$")
12+
_default_scm_version = SCMVersion(Version("0.0.0"), None, False, None, None) # noqa: FBT003
13+
14+
15+
def get_version() -> str:
16+
"""Get current project version from Git tags or changelog."""
17+
scm_version = get_version_from_scm(_root) or _default_scm_version
18+
if scm_version.version <= Version("0.1"): # Missing Git tags?
19+
with suppress(OSError, StopIteration): # noqa: SIM117
20+
with _changelog.open("r", encoding="utf8") as file:
21+
match = next(filter(None, map(_changelog_version_re.match, file)))
22+
scm_version = scm_version._replace(version=Version(match.group(1)))
23+
return default_version_formatter(scm_version)
24+
25+
26+
if __name__ == "__main__":
27+
print(get_version())

scripts/make.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ def _uv_install(venv: Path) -> None:
4848
_shell("uv sync")
4949

5050

51-
def _run(version: str, cmd: str, *args: str, no_sync: bool = False, **kwargs: Any) -> None:
51+
def _run(version: str, cmd: str, *args: str, **kwargs: Any) -> None:
5252
kwargs = {"check": True, **kwargs}
53-
uv_run = ["uv", "run"]
54-
if no_sync:
55-
uv_run.append("--no-sync")
53+
uv_run = ["uv", "run", "--no-sync"]
5654
if version == "default":
5755
with _environ(UV_PROJECT_ENVIRONMENT=".venv"):
5856
subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510

0 commit comments

Comments
 (0)