Skip to content

Commit 71e4342

Browse files
committed
feat: version and description of generated project is dynamic field of pyproject.toml
1 parent 309264c commit 71e4342

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Version and description of generated project is dynamic field of pyproject.toml
13+
814
## [0.2.0] - 2025-03-26
915

1016
### Added

template/pyproject.toml.copier

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[project]
22
name = "{{ project_slug }}"
3-
version = "0.1.0"
43
readme = "README.md"
5-
description = "{{ description }}"
4+
dynamic = ["version", "description"]
65
dependencies = [
76
"beautifulsoup4>=4.13.3",
87
"sphinx>=8.0",
@@ -36,5 +35,5 @@ dev = [
3635
sample-docs = { path = "{{ sample_docs_slug }}", editable = true }
3736

3837
[build-system]
39-
requires = ["flit_core >=3.2,<4"]
38+
requires = ["flit_core >=3.12,<4"]
4039
build-backend = "flit_core.buildapi"
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
"""
2-
Register theme with Sphinx.
2+
{{ description }}
33
"""
44

5+
__version__ = "0.1.0"
6+
7+
58
from pathlib import Path
69

710
from sphinx.application import Sphinx
11+
from sphinx.util.typing import ExtensionMetadata
812

913
THEME_NAME = "{{ project_slug }}"
1014

1115

12-
def setup(app: Sphinx) -> dict[str, bool]:
16+
def setup(app: Sphinx) -> ExtensionMetadata:
1317
"""Setup the Sphinx application."""
1418
theme_path = str(Path(__file__).parent.resolve())
1519
app.add_html_theme(THEME_NAME, theme_path)
1620

17-
return {"parallel_read_safe": True, "parallel_write_safe": True}
21+
return {
22+
"parallel_read_safe": True,
23+
"parallel_write_safe": True,
24+
"version": __version__,
25+
}

tests/test_bake/defaults/pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[project]
22
name = "sphinx_foo_theme"
3-
version = "0.1.0"
43
readme = "README.md"
5-
description = "Foo but full-bar theme."
4+
dynamic = ["version", "description"]
65
dependencies = [
76
"beautifulsoup4>=4.13.3",
87
"sphinx>=8.0",
@@ -36,5 +35,5 @@ dev = [
3635
sample-docs = { path = "sample_docs", editable = true }
3736

3837
[build-system]
39-
requires = ["flit_core >=3.2,<4"]
38+
requires = ["flit_core >=3.12,<4"]
4039
build-backend = "flit_core.buildapi"
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
"""
2-
Register theme with Sphinx.
2+
Foo but full-bar theme.
33
"""
44

5+
__version__ = "0.1.0"
6+
7+
58
from pathlib import Path
69

710
from sphinx.application import Sphinx
11+
from sphinx.util.typing import ExtensionMetadata
812

913
THEME_NAME = "sphinx_foo_theme"
1014

1115

12-
def setup(app: Sphinx) -> dict[str, bool]:
16+
def setup(app: Sphinx) -> ExtensionMetadata:
1317
"""Setup the Sphinx application."""
1418
theme_path = str(Path(__file__).parent.resolve())
1519
app.add_html_theme(THEME_NAME, theme_path)
1620

17-
return {"parallel_read_safe": True, "parallel_write_safe": True}
21+
return {
22+
"parallel_read_safe": True,
23+
"parallel_write_safe": True,
24+
"version": __version__,
25+
}

0 commit comments

Comments
 (0)