Skip to content

Commit 1bcad56

Browse files
committed
Make docs read data from pyproject.toml
1 parent 77c6da0 commit 1bcad56

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

docs/conf.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,18 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = "django-upgrade"
20+
with (here / ".." / "pyproject.toml").open("rb") as fp:
21+
pyproject_toml_data = tomllib.load(fp)
22+
23+
project = pyproject_toml_data["project"]["name"]
2124
copyright = "2021 Adam Johnson"
2225
author = "Adam Johnson"
2326

2427
# The version info for the project you're documenting, acts as replacement
2528
# for |version| and |release|, also used in various other places throughout
2629
# the built documents.
2730

28-
29-
def _get_version() -> str:
30-
with (here / ".." / "pyproject.toml").open("rb") as fp:
31-
data = tomllib.load(fp)
32-
version: str = data["project"]["version"]
33-
return version
34-
35-
36-
version = _get_version()
31+
version = pyproject_toml_data["project"]["version"]
3732
release = version
3833

3934
# -- General configuration ---------------------------------------------------

0 commit comments

Comments
 (0)