Skip to content

Commit 5a12e29

Browse files
fix: use importlib.metadata for docs building
1 parent feadbf6 commit 5a12e29

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

docs/conf.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15+
import importlib.metadata
1516
import importlib.util
1617
import inspect
1718
import os
@@ -106,14 +107,10 @@
106107
# |version| and |release|, also used in various other places throughout the
107108
# built documents.
108109
#
109-
# The short X.Y version.
110-
111-
version = ""
112-
with open("../disnake/__init__.py") as f:
113-
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) # type: ignore
114-
115110
# The full version, including alpha/beta/rc tags.
116-
release = version
111+
release = importlib.metadata.version("disnake")
112+
# The short X.Y version.
113+
version = ".".join(release.split(".")[:2])
117114

118115

119116
_IS_READTHEDOCS = bool(os.getenv("READTHEDOCS"))

0 commit comments

Comments
 (0)