Skip to content

Commit 004f323

Browse files
authored
Correct dynamic versioning (#51)
* correct dynamic versioning * Update pyproject.toml * Update test_template.py
1 parent d8ebd85 commit 004f323

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ requires = [ "setuptools>=82.0.1", "setuptools-scm>=10.0.5" ]
44

55
[project]
66
name = "template-uv-python-research-software"
7-
version = "0.0.1"
87
description = "A template for Pythonic research software with environment management through uv."
98
readme = "README.md"
109
authors = [
@@ -18,6 +17,7 @@ classifiers = [
1817
"Programming Language :: Python :: 3.13",
1918
"Programming Language :: Python :: 3.14",
2019
]
20+
dynamic = [ "version" ]
2121
dependencies = [
2222
"copier>=9.15.1",
2323
]

pyproject.toml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [ "setuptools>=64", "setuptools-scm>=8" ]
44

55
[project]
66
name = "{{ project_name }}"
7-
version = "0.0.1"
7+
dynamic = [ "version" ]
88
description = "{{ project_description }}"
99
readme = "README.md"
1010
authors = [

tests/test_template.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ def _init_git_repo(path: Path) -> str:
2424
return _git("rev-parse", "HEAD", cwd=path)
2525

2626

27+
def _commit_project(path: Path) -> None:
28+
subprocess.run(["git", "init"], cwd=path, check=True)
29+
subprocess.run(["git", "config", "user.name", "Test User"], cwd=path, check=True)
30+
subprocess.run(
31+
["git", "config", "user.email", "test@example.com"], cwd=path, check=True
32+
)
33+
subprocess.run(["git", "add", "."], cwd=path, check=True)
34+
subprocess.run(["git", "commit", "-m", "Initial commit"], cwd=path, check=True)
35+
36+
2737
def test_template(tmp_path: Path) -> None:
2838
# Path to the Copier template root
2939
template_path = Path(__file__).resolve().parent.parent
@@ -53,6 +63,8 @@ def test_template(tmp_path: Path) -> None:
5363
assert not (dst_path / ".git").exists()
5464
assert not (dst_path / "renovate.json").exists()
5565

66+
_commit_project(dst_path)
67+
5668
# Run pytest from the copied template
5769
subprocess.run(["uv", "run", "pytest"], cwd=dst_path, check=True)
5870

uv.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)