From 39e434a8ffaf47ef1be7af77d53982dd1476fac4 Mon Sep 17 00:00:00 2001 From: Oleh Prypin Date: Fri, 24 Nov 2023 16:02:30 +0100 Subject: [PATCH] Use hatch-mkdocs and hatch-pip-compile for docs deps --- .github/workflows/deploy-docs.yml | 6 +++--- .tools/docs-dependencies.sh | 4 ---- pyproject.toml | 19 +++++++++---------- .../requirements-docs.txt | 12 +++++++++--- 4 files changed, 21 insertions(+), 20 deletions(-) delete mode 100755 .tools/docs-dependencies.sh rename docs/requirements.txt => requirements/requirements-docs.txt (89%) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index dd05dfd..3ad1883 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -13,11 +13,11 @@ jobs: - name: Install Python uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: '3.11' - name: Install dependencies - run: pip install --no-deps -r docs/requirements.txt + run: pip install --no-deps -r requirements/requirements-docs.txt - name: Build site - run: mkdocs build + run: mkdocs build --strict - name: Upload to GitHub Pages uses: actions/upload-pages-artifact@v2 with: diff --git a/.tools/docs-dependencies.sh b/.tools/docs-dependencies.sh deleted file mode 100755 index eebbf94..0000000 --- a/.tools/docs-dependencies.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -e - -hatch env show --json | jq -r ".docs.dependencies | .[]" | pip-compile -U - -o docs/requirements.txt diff --git a/pyproject.toml b/pyproject.toml index 36196cc..fe6945d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,6 +54,12 @@ path = "mkdocstrings_handlers/crystal/__init__.py" [tool.hatch.build.targets.sdist] include = ["/mkdocstrings_handlers", "/tests"] +[tool.hatch.env] +requires = [ + "hatch-mkdocs", + "hatch-pip-compile", +] + [tool.hatch.build.targets.wheel] packages = ["mkdocstrings_handlers"] @@ -98,17 +104,10 @@ format = [ "ruff format -q mkdocstrings_handlers tests", ] +[tool.hatch.env.collectors.mkdocs.docs] [tool.hatch.envs.docs] -detached = true -dependencies = [ - "mkdocs >=1.5", - "mkdocs-material >=7.1.4", - "mkdocs-section-index >=0.3.0", - "mkdocstrings >=0.15.0", - "mkdocstrings-python >=0.7.1", - "pymdown-extensions >=8.2", - "markdown-callouts >=0.2", -] +type = "pip-compile" +pip-compile-hashes = false [tool.ruff] line-length = 100 diff --git a/docs/requirements.txt b/requirements/requirements-docs.txt similarity index 89% rename from docs/requirements.txt rename to requirements/requirements-docs.txt index 966ffdd..eeb9cb6 100644 --- a/docs/requirements.txt +++ b/requirements/requirements-docs.txt @@ -1,9 +1,15 @@ # -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: +# This file is autogenerated by hatch-pip-compile with Python 3.11 # -# pip-compile --output-file=docs/requirements.txt - +# - markdown-callouts +# - mkdocs +# - mkdocs-material +# - mkdocs-section-index +# - mkdocstrings +# - mkdocstrings-python +# - pymdown-extensions # + babel==2.13.1 # via mkdocs-material certifi==2023.7.22