Skip to content

Commit 2b4037d

Browse files
fix: use importlib.metadata for docs building
1 parent fbb422c commit 2b4037d

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
@@ -104,14 +105,10 @@
104105
# |version| and |release|, also used in various other places throughout the
105106
# built documents.
106107
#
107-
# The short X.Y version.
108-
109-
version = ""
110-
with open("../disnake/__init__.py") as f:
111-
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) # type: ignore
112-
113108
# The full version, including alpha/beta/rc tags.
114-
release = version
109+
release = importlib.metadata.version("disnake")
110+
# The short X.Y version.
111+
version = ".".join(release.split(".")[:2])
115112

116113

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

0 commit comments

Comments
 (0)