Skip to content

Commit bf04089

Browse files
authored
Do version handling in the root docs in the same way as template (#105)
2 parents f6754f4 + 979d665 commit bf04089

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

77
import sys
8+
from importlib.metadata import version
89
from pathlib import Path
910
from subprocess import check_output
1011

@@ -16,10 +17,10 @@
1617
project = "python-copier-template"
1718

1819
# The full version, including alpha/beta/rc tags.
19-
release = check_output(["git", "describe", "--always", "--tags"]).decode()
20+
release = version(project)
2021

2122
# The short X.Y version.
22-
if "-" in release:
23+
if "+" in release:
2324
# Not on a tag, use branch name
2425
root = Path(__file__).absolute().parent.parent
2526
git_branch = check_output("git branch --show-current".split(), cwd=root)

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ dev = [
2121
"tox-direct",
2222
]
2323

24+
[tool.setuptools_scm]
25+
2426
[tool.pytest.ini_options]
2527
# Run pytest with all our checkers, and don't spam us with massive tracebacks on error
2628
addopts = """

0 commit comments

Comments
 (0)