diff --git a/.readthedocs.yml b/.readthedocs.yml index 6622742e..25bf64ad 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,7 +10,8 @@ sphinx: python: install: - - requirements: docs/requirements.txt + - path: . + requirements: docs/requirements.txt formats: - htmlzip diff --git a/docs/conf.py b/docs/conf.py index 9f48a537..2f51dbd3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,26 +27,19 @@ # # needs_sphinx = '1.0' -import pathlib +import importlib.metadata import re -_docs_path = pathlib.Path(__file__).parent -_version_path = _docs_path / '../aiobotocore/__init__.py' - - -with _version_path.open() as fp: - try: - _version_info = re.search( - r"^__version__ = '" - r"(?P\d+)" - r"\.(?P\d+)" - r"\.(?P\d+)" - r"(?P.*)?'$", - fp.read(), - re.M, - ).groupdict() - except IndexError: - raise RuntimeError('Unable to determine version.') +try: + _version_info = re.fullmatch( + r"(?P\d+)" + r"\.(?P\d+)" + r"\.(?P\d+)" + r"(?P.*)?", + importlib.metadata.version('aiobotocore'), + ).groupdict() +except IndexError: + raise RuntimeError('Unable to determine version.') # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom