Skip to content

Commit 2f52d67

Browse files
committed
Use correct version info for docs
The docs were using 0.1 as the project's version number. Read the correct version from `wtforms_components/__init__.py` instead.
1 parent 72c1d6f commit 2f52d67

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/conf.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
# All configuration values have a default; values that are commented out
1111
# serve to show the default.
1212

13+
import pathlib
14+
import re
15+
16+
17+
def get_version():
18+
path = pathlib.Path(__file__).parent.parent / "wtforms_components" / "__init__.py"
19+
contents = path.read_text()
20+
pattern = r'^__version__ = "(.*?)"$'
21+
return re.search(pattern, contents, re.MULTILINE).group(1)
22+
1323

1424
# If extensions (or modules to document with autodoc) are in another directory,
1525
# add these directories to sys.path here. If the directory is relative to the
@@ -54,9 +64,9 @@
5464
# built documents.
5565
#
5666
# The short X.Y version.
57-
version = "0.1"
67+
version = get_version()
5868
# The full version, including alpha/beta/rc tags.
59-
release = "0.1"
69+
release = version
6070

6171
# The language for content autogenerated by Sphinx. Refer to documentation
6272
# for a list of supported languages.

0 commit comments

Comments
 (0)