From d49427f7146fa365f83e0e8051f91821b74e96b9 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Thu, 15 Jun 2023 11:54:50 -0700 Subject: [PATCH 1/6] PYTHON-3738 Use tox for sphinx doc instead of setup.py --- tox.ini | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tox.ini b/tox.ini index e199914cb5..3aa5ffa20c 100644 --- a/tox.ini +++ b/tox.ini @@ -75,3 +75,17 @@ commands = {[testenv:typecheck-mypy]commands} {[testenv:typecheck-pyright]commands} {[testenv:typecheck-pyright-strict]commands} + +[testenv:doc-test] +description = run sphinx doc tests +deps = + sphinx +commands = + sphinx-build -E -b doctest doc ./doc/_build/doctest + +[testenv:doc] +description = build sphinx docs +deps = + sphinx +commands = + pre-commit run --all-files --hook-stage manual From 852aaf297a3d512a433e19a01a41be19795dcb3f Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Thu, 15 Jun 2023 17:41:58 -0700 Subject: [PATCH 2/6] Add linkcheck command to tox --- .github/workflows/test-python.yml | 7 ++----- tox.ini | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 83def93f57..6dbb7cb558 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -80,12 +80,9 @@ jobs: - uses: actions/setup-python@v2 with: cache: 'pip' - cache-dependency-path: 'setup.py' - name: Install dependencies run: | - python -m pip install -U pip - python -m pip install sphinx + pip install tox - name: Check links run: | - cd doc - make linkcheck + tox -e linkcheck diff --git a/tox.ini b/tox.ini index 3aa5ffa20c..2d21d8938f 100644 --- a/tox.ini +++ b/tox.ini @@ -76,16 +76,23 @@ commands = {[testenv:typecheck-pyright]commands} {[testenv:typecheck-pyright-strict]commands} +[testenv:doc] +description = build sphinx docs +deps = + sphinx +commands = + sphinx-build -E -b doc doc ./doc/_build/html + [testenv:doc-test] description = run sphinx doc tests deps = - sphinx + {[testenv:doc]deps} commands = sphinx-build -E -b doctest doc ./doc/_build/doctest -[testenv:doc] -description = build sphinx docs +[testenv:linkcheck] +description = check links of sphinx docs deps = - sphinx + {[testenv:doc]deps} commands = - pre-commit run --all-files --hook-stage manual + sphinx-build -E -b linkcheck doc ./doc/_build/linkcheck From 132caf06f5c58d67f3e1c4e70da3c1f7a4cd779f Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Fri, 16 Jun 2023 13:32:58 -0700 Subject: [PATCH 3/6] Update tox envs --- tox.ini | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 2d21d8938f..6e9f73cd64 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,20 @@ envlist = lint, # Run pre-commit on all files, including stages that require manual fixes. lint-manual, + # Typecheck using mypy. + typecheck-mypy, + # Typecheck using pyright. + typecheck-pyright, + # Typecheck using pyright strict. + typecheck-pyright-strict, # Typecheck all files. - typecheck + typecheck, + # Build sphinx docs + doc, + # Test sphinx docs + doc-test, + # Linkcheck sphin docs + linkcheck [testenv:test] description = run unit tests From 0ed29fa3b17154ee96d7213bfb37afa48a9b1836 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Fri, 16 Jun 2023 13:42:08 -0700 Subject: [PATCH 4/6] Fix tox doc env --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 6e9f73cd64..9afa1923c9 100644 --- a/tox.ini +++ b/tox.ini @@ -93,7 +93,7 @@ description = build sphinx docs deps = sphinx commands = - sphinx-build -E -b doc doc ./doc/_build/html + sphinx-build -E -b html doc ./doc/_build/html [testenv:doc-test] description = run sphinx doc tests From a58ecc8d6b14270fba8aaa8359ed2a47e39d4f44 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Fri, 16 Jun 2023 13:44:48 -0700 Subject: [PATCH 5/6] Fix linkcheck action dependency path --- .github/workflows/test-python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 6dbb7cb558..d7c442cc49 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -80,6 +80,7 @@ jobs: - uses: actions/setup-python@v2 with: cache: 'pip' + cache-dependency-path: 'setup.py' - name: Install dependencies run: | pip install tox From 2362932e34becdfa7a5140589eb64a0a0a855c4e Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Fri, 16 Jun 2023 14:39:37 -0700 Subject: [PATCH 6/6] Fix typo --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9afa1923c9..46c1a697de 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ envlist = doc, # Test sphinx docs doc-test, - # Linkcheck sphin docs + # Linkcheck sphinx docs linkcheck [testenv:test]