diff --git a/docs/conf.py b/docs/conf.py index 7e050d9..93662ed 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,33 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import codecs -import os -import re - - -def read(*parts): - """ - Build an absolute path from *parts* and and return the contents of the - resulting file. Assume UTF-8 encoding. - """ - here = os.path.abspath(os.path.dirname(__file__)) - with codecs.open(os.path.join(here, *parts), "rb", "utf-8") as f: - return f.read() - - -def find_version(*file_paths): - """ - Build a path from *file_paths* and search for a ``__version__`` - string inside. - """ - version_file = read(*file_paths) - version_match = re.search( - r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M - ) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") +from importlib import metadata # If extensions (or modules to document with autodoc) are in another directory, @@ -88,11 +62,11 @@ def find_version(*file_paths): # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -# + +# The full version, including alpha/beta/rc tags. +release = metadata.version("prometheus-async") # The short X.Y version. -release = find_version("..", "src", project.replace("-", "_"), "__init__.py") version = release.rsplit(".", 1)[0] -# The full version, including alpha/beta/rc tags. # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -314,10 +288,13 @@ def find_version(*file_paths): # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False -# GitHub has rate limits linkcheck_ignore = [ + # Rate limits r"https://github.com/.*/(issues|pull)/\d+", r"https://twitter.com/.*", + # Anchors are a problem + r"https://github.com/prometheus/client_python#twisted", + r"https://github.com/prometheus/client_python#counter", ]