diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 8ffa1b26f..9b245271c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -5,31 +5,29 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: python: "3.12" jobs: post_checkout: - # RTD defaults to a depth of 50 but Briefcase versioning may require - # much more git history to accurately determine the SCM version + # RTD defaults to a depth of 50 but qbittorrent-api versioning may require + # much more Git history to accurately determine the SCM version - git fetch --unshallow pre_build: - tox -e docs-lint -# Build documentation in the docs/ directory with Sphinx sphinx: builder: html configuration: docs/source/conf.py fail_on_warning: true -# Also build the docs in to a PDF formats: - pdf -# Declare the Python requirements required to build your docs python: install: - method: pip path: . extra_requirements: - dev + - docs diff --git a/pyproject.toml b/pyproject.toml index 125429829..158042795 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,17 +43,20 @@ dev = [ "pre-commit <3.6.0 ; python_version < '3.9'", "pre-commit ==3.8.0 ; python_version >= '3.9'", "pytest ==8.3.3", - "sphinx ==8.0.2; python_version >= '3.10'", - "sphinx-autobuild ==2024.9.19 ; python_version >= '3.9'", - "sphinx-copybutton ==0.5.2", - "sphinxcontrib-spelling ==8.0.0", - "sphinx-autodoc-typehints <2.1.0 ; python_version < '3.9'", - "sphinx-autodoc-typehints ==2.4.4 ; python_version >= '3.9'", "tox ==4.21.0", "twine ==5.1.1", "types-requests ==2.32.0.20240914", ] +docs = [ + # building docs requires Python >3.10 + "sphinx ==8.0.2", + "sphinx-autobuild ==2024.9.19", + "sphinx-copybutton ==0.5.2", + "sphinxcontrib-spelling ==8.0.0", + "sphinx-autodoc-typehints ==2.4.4", +] + [project.urls] "Homepage" = "https://github.com/rmartin16/qbittorrent-api" "Documentation" = "https://qbittorrent-api.readthedocs.io/" @@ -78,7 +81,6 @@ max-complexity = 15 [tool.ruff.lint.per-file-ignores] "tests/*" = ["C408", "S101", "S108", "S110", "S106", "S105", "C901"] - [tool.pytest.ini_options] addopts = """ --doctest-modules diff --git a/tox.ini b/tox.ini index 613218c59..348c7baa0 100644 --- a/tox.ini +++ b/tox.ini @@ -31,14 +31,7 @@ commands_post = !ci: docker stop qbt-tox-testing docs_dir = {tox_root}{/}docs source_dir = {[docs]docs_dir}{/}source build_dir = {[docs]docs_dir}{/}_build -# replace when Sphinx>=7.3 and Python 3.8 is dropped: -# -T => --show-traceback -# -W => --fail-on-warning -# -b => --builder -# -v => --verbose -# -a => --write-all -# -E => --fresh-env -sphinx_args = -T -W --keep-going --jobs auto +sphinx_args = --show-traceback --fail-on-warning --keep-going --jobs auto [testenv:docs{,-lint,-all,-man,-live,-live-src}] base_python = py312 @@ -48,15 +41,15 @@ package = wheel wheel_build_env = .pkg change_dir = docs passenv = FORCE_COLOR -deps = -e {tox_root}[dev] +deps = -e {tox_root}[docs] commands = - !lint-!all-!man-!live : python -m sphinx {[docs]sphinx_args} -b html {[docs]source_dir} {[docs]build_dir}/html - lint : python -m sphinx {[docs]sphinx_args} -b linkcheck {[docs]source_dir} {[docs]build_dir}/links - lint : python -m sphinx {[docs]sphinx_args} -b spelling {[docs]source_dir} {[docs]build_dir}/spell - all : python -m sphinx {[docs]sphinx_args} -v -a -E -b html {[docs]source_dir} {[docs]build_dir}/html - man : python -m sphinx {[docs]sphinx_args} -b man {[docs]source_dir} {[docs]build_dir}/man - live-!src : sphinx-autobuild {[docs]sphinx_args} {posargs} -b html {[docs]source_dir} {[docs]build_dir}{/}live - live-src : sphinx-autobuild {[docs]sphinx_args} {posargs} -a -E --watch {tox_root}{/}src{/}qbittorrentapi -b html {[docs]source_dir} {[docs]build_dir}{/}live + !lint-!all-!man-!live : python -m sphinx {[docs]sphinx_args} --builder html {[docs]source_dir} {[docs]build_dir}/html + lint : python -m sphinx {[docs]sphinx_args} --builder linkcheck {[docs]source_dir} {[docs]build_dir}/links + lint : python -m sphinx {[docs]sphinx_args} --builder spelling {[docs]source_dir} {[docs]build_dir}/spell + all : python -m sphinx {[docs]sphinx_args} --verbose --write-all --fresh-env --builder html {[docs]source_dir} {[docs]build_dir}/html + man : python -m sphinx {[docs]sphinx_args} --builder man {[docs]source_dir} {[docs]build_dir}/man + live-!src : sphinx-autobuild {[docs]sphinx_args} {posargs} --builder html {[docs]source_dir} {[docs]build_dir}{/}live + live-src : sphinx-autobuild {[docs]sphinx_args} {posargs} --write-all --fresh-env --watch {tox_root}{/}src{/}qbittorrentapi --builder html {[docs]source_dir} {[docs]build_dir}{/}live [testenv:package] skip_install = True