diff --git a/docs/source/conf.py b/docs/source/conf.py index 9e9c74538..35581bc3c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,24 +12,20 @@ # import os import sys -from configparser import ConfigParser from datetime import datetime +from importlib.metadata import version as metadata_version base_path = os.path.abspath("../..") sys.path.insert(0, os.path.join(base_path, "src")) -setup_cfg = ConfigParser() -setup_cfg.read(os.path.join(base_path, "setup.cfg")) - # -- Project information ----------------------------------------------------- -project = setup_cfg["metadata"]["name"] -copyright = "{}, {}".format(datetime.today().year, setup_cfg["metadata"]["author"]) -author = setup_cfg["metadata"]["author"] +project = "qbittorrent-api" +author = "Russell Martin" +copyright = f"{datetime.today().year}, {author}" # The full version, including alpha/beta/rc tags -version = release = "v" + setup_cfg["metadata"]["version"] - +release = metadata_version("qbittorrent-api") # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions coming diff --git a/pyproject.toml b/pyproject.toml index 2f48ba3ea..13d01ec6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,9 @@ [build-system] -requires = ["setuptools >=61"] +requires = ["setuptools >=64", "setuptools-scm >=8"] build-backend = "setuptools.build_meta" [project] name = "qbittorrent-api" -version = "2023.10.54" requires-python = ">=3.8" description = "Python client for qBittorrent v4.1+ Web API." authors = [{name = "Russell Martin"}] @@ -28,7 +27,7 @@ classifiers = [ "Topic :: Utilities", "Topic :: Communications :: File Sharing", ] -dynamic = ["readme"] +dynamic = ["readme", "version"] dependencies = [ "requests >= 2.16.0", "urllib3 >= 1.24.2", @@ -63,6 +62,9 @@ dev = [ [tool.setuptools.dynamic] readme = {file = ["README.md", "CHANGELOG.md", "LICENSE"], content-type = "text/markdown"} +[tool.setuptools_scm] +# section must be present to trigger its use + [tool.isort] profile = "black" skip_glob = ["venv*"]