From 7f819b5f08b5e2cff8e8177a713b19f069ca35d9 Mon Sep 17 00:00:00 2001 From: Juro Oravec Date: Sun, 14 Sep 2025 16:20:49 +0200 Subject: [PATCH] refactor: replace hatch with pip (#1347) --- .github/workflows/docs.yml | 14 +++--- pyproject.toml | 66 +++++++----------------- requirements-docs.in | 20 ++++++++ requirements-docs.txt | 100 +++++++++++++++++-------------------- 4 files changed, 92 insertions(+), 108 deletions(-) create mode 100644 requirements-docs.in diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e958fa5c..2fd17564 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -58,8 +58,8 @@ jobs: python -m pip install --upgrade pip wheel # NOTE: pin virtualenv to <20.31 until asv fixes it. # See https://github.com/airspeed-velocity/asv/issues/1484 - python -m pip install -q hatch pre-commit asv virtualenv==20.30 - hatch --version + python -m pip install -q pre-commit asv virtualenv==20.30 + python -m pip install -r requirements-docs.txt ########################################### # RECORD BENCHMARK - ONLY ON PUSH TO MASTER @@ -166,9 +166,9 @@ jobs: - name: Check docs in pull requests with strict mode if: github.event_name == 'pull_request' run: | - # XXX Enable strict mode once docs are clean + # TODO: Enable strict mode once docs are clean echo "Strict check of docs disabled." - # hatch run docs:build --strict + # python -m mkdocs build --strict - name: Build & deploy "dev" docs for a new commit to master if: github.event_name == 'push' && github.ref_type != 'tag' @@ -180,7 +180,7 @@ jobs: git checkout master export SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7) - hatch run docs:mike deploy --push --update-aliases --title "dev (${SHORT_SHA})" dev + python -m mike deploy --push --update-aliases --title "dev (${SHORT_SHA})" dev - name: Build & deploy docs for a new tag if: github.ref_type == 'tag' && github.event_name == 'push' @@ -191,5 +191,5 @@ jobs: git pull origin gh-pages git checkout master - hatch run docs:mike deploy --push --update-aliases ${{ github.ref_name }} latest - hatch run docs:mike set-default latest --push + python -m mike deploy --push --update-aliases ${{ github.ref_name }} latest + python -m mike set-default latest --push diff --git a/pyproject.toml b/pyproject.toml index ba123894..98b7c8ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,10 @@ Issues = "https://github.com/django-components/django-components/issues" Donate = "https://github.com/sponsors/EmilStenstrom" +########################################### +# TOOLS +########################################### + [tool.setuptools.packages.find] where = ["src"] include = ["django_components*"] @@ -143,35 +147,34 @@ ignore = [ "N818", # Exception name `NotRegistered` should be named with an Error suffix ] -[tool.ruff.lint.isort] -known-first-party = ["django_components"] - [tool.ruff.lint.per-file-ignores] "tests/*" = [ "ARG002", # Unused method argument: `components_settings` - "ANN", # Annotations are not needed for tests - "N806", # Variable `SimpleComponent` in function should be lowercase - "PLC0415", # `import` should be at the top-level of a file + "ANN", # Annotations are not needed for tests + "N806", # Variable `SimpleComponent` in function should be lowercase + "PLC0415", # `import` should be at the top-level of a file "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` - "S101", # Use of `assert` detected + "S101", # Use of `assert` detected "TRY002", # Create your own exception ] "benchmarks/*" = [ "ARG002", # Unused method argument: `components_settings` - "ANN", # Annotations are not needed for tests - "N806", # Variable `SimpleComponent` in function should be lowercase - "PLC0415", # `import` should be at the top-level of a file + "ANN", # Annotations are not needed for tests + "N806", # Variable `SimpleComponent` in function should be lowercase + "PLC0415", # `import` should be at the top-level of a file "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` - "S101", # Use of `assert` detected + "S101", # Use of `assert` detected "TRY002", # Create your own exception ] "sampleproject/*" = [ - "ARG002", # Unused method argument - "ANN", # Annotations are not needed for tests - "T201", # `print` found - "DTZ", # `datetime` found + "ARG002", # Unused method argument + "ANN", # Annotations are not needed for tests + "T201", # `print` found + "DTZ", # `datetime` found ] +[tool.ruff.lint.isort] +known-first-party = ["django_components"] [tool.mypy] check_untyped_defs = true @@ -191,36 +194,3 @@ testpaths = [ "tests", ] asyncio_mode = "auto" - -[tool.hatch.env] -requires = [ - "hatch-mkdocs", - "hatch-pip-compile", -] - -[tool.hatch.envs.default] -dependencies = [ - "django", - "djc-core-html-parser", - "tox", - "pytest", - "ruff", - "pre-commit", - "mypy", -] -type = "pip-compile" -lock-filename = "requirements-dev.txt" - -[tool.hatch.envs.docs] -type = "pip-compile" -lock-filename = "requirements-docs.txt" -detached = false -# Dependencies are fetched automatically from the mkdocs.yml file with hatch-mkdocs -dependencies = [ - "pygments", - "pygments-djc", - "mkdocs-awesome-nav", -] - -[tool.hatch.env.collectors.mkdocs.docs] -path = "mkdocs.yml" diff --git a/requirements-docs.in b/requirements-docs.in new file mode 100644 index 00000000..617f00b8 --- /dev/null +++ b/requirements-docs.in @@ -0,0 +1,20 @@ +markdown-exec +mike +mkdocs +mkdocs-autorefs +mkdocs-awesome-nav +mkdocs-gen-files +mkdocs-git-authors-plugin +mkdocs-git-revision-date-localized-plugin +mkdocs-include-markdown-plugin +mkdocs-material +mkdocs-material[imaging] +mkdocs-minify-plugin +mkdocs-redirects +mkdocstrings +mkdocstrings-python +pymdown-extensions +pygments +pygments-djc +django>=4.2 +djc-core-html-parser>=1.0 \ No newline at end of file diff --git a/requirements-docs.txt b/requirements-docs.txt index 43f34cbe..ecd5636c 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,34 +1,19 @@ # -# This file is autogenerated by hatch-pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: # -# - markdown-exec -# - mike -# - mkdocs -# - mkdocs-autorefs -# - mkdocs-awesome-nav -# - mkdocs-gen-files -# - mkdocs-git-authors-plugin -# - mkdocs-git-revision-date-localized-plugin -# - mkdocs-include-markdown-plugin -# - mkdocs-material -# - mkdocs-material[imaging] -# - mkdocs-minify-plugin -# - mkdocs-redirects -# - mkdocstrings -# - mkdocstrings-python -# - pymdown-extensions -# - pygments -# - pygments-djc -# - django>=4.2 -# - djc-core-html-parser>=1.0 +# pip-compile requirements-docs.in # - +annotated-types==0.7.0 + # via pydantic asgiref==3.9.1 # via django babel==2.17.0 # via # mkdocs-git-revision-date-localized-plugin # mkdocs-material +backrefs==5.9 + # via mkdocs-material bracex==2.6 # via wcmatch cairocffi==1.7.1 @@ -41,9 +26,10 @@ cffi==1.17.1 # via cairocffi charset-normalizer==3.4.3 # via requests -click==8.1.8 +click==8.2.1 # via # mkdocs + # mkdocs-material colorama==0.4.6 # via # griffe @@ -54,10 +40,10 @@ cssselect2==0.8.0 # via cairosvg defusedxml==0.7.1 # via cairosvg -django==4.2.24 - # via hatch.envs.docs +django==5.2.5 + # via -r requirements-docs.in djc-core-html-parser==1.0.2 - # via hatch.envs.docs + # via -r requirements-docs.in ghp-import==2.1.0 # via mkdocs gitdb==4.0.12 @@ -90,7 +76,7 @@ markdown==3.8.2 # mkdocstrings # pymdown-extensions markdown-exec==1.11.0 - # via hatch.envs.docs + # via -r requirements-docs.in markupsafe==3.0.2 # via # jinja2 @@ -102,10 +88,10 @@ mergedeep==1.3.4 # mkdocs # mkdocs-get-deps mike==2.1.3 - # via hatch.envs.docs + # via -r requirements-docs.in mkdocs==1.6.1 # via - # hatch.envs.docs + # -r requirements-docs.in # mike # mkdocs-autorefs # mkdocs-awesome-nav @@ -119,19 +105,17 @@ mkdocs==1.6.1 # mkdocstrings mkdocs-autorefs==1.4.2 # via - # hatch.envs.docs + # -r requirements-docs.in # mkdocstrings # mkdocstrings-python -mkdocs-awesome-nav==3.0.0 - # via hatch.envs.docs +mkdocs-awesome-nav==3.1.2 + # via -r requirements-docs.in mkdocs-gen-files==0.5.0 - # via hatch.envs.docs + # via -r requirements-docs.in mkdocs-get-deps==0.2.0 - # via - # mkdocs - # mkdocstrings + # via mkdocs mkdocs-git-authors-plugin==0.10.0 - # via hatch.envs.docs + # via -r requirements-docs.in mkdocs-git-revision-date-localized-plugin==1.4.7 # via hatch.envs.docs mkdocs-include-markdown-plugin==7.1.7 @@ -141,42 +125,45 @@ mkdocs-material==9.6.19 mkdocs-material-extensions==1.3.1 # via mkdocs-material mkdocs-minify-plugin==0.8.0 - # via hatch.envs.docs + # via -r requirements-docs.in mkdocs-redirects==1.2.2 - # via hatch.envs.docs + # via -r requirements-docs.in mkdocstrings==0.30.0 # via - # hatch.envs.docs + # -r requirements-docs.in # mkdocstrings-python mkdocstrings-python==1.17.0 - # via hatch.envs.docs + # via -r requirements-docs.in +natsort==8.4.0 + # via mkdocs-awesome-nav packaging==25.0 - # via - # mkdocs + # via mkdocs paginate==0.5.7 # via mkdocs-material pathspec==0.12.1 - # via - # mkdocs + # via mkdocs pillow==11.3.0 # via # cairosvg # mkdocs-material platformdirs==4.3.8 - # via - # mkdocs-get-deps + # via mkdocs-get-deps pycparser==2.22 # via cffi +pydantic==2.11.7 + # via mkdocs-awesome-nav +pydantic-core==2.33.2 + # via pydantic pygments==2.19.2 # via - # hatch.envs.docs + # -r requirements-docs.in # mkdocs-material # pygments-djc pygments-djc==1.0.1 - # via hatch.envs.docs + # via -r requirements-docs.in pymdown-extensions==10.16.1 # via - # hatch.envs.docs + # -r requirements-docs.in # markdown-exec # mkdocs-material # mkdocstrings @@ -197,8 +184,6 @@ pyyaml-env-tag==1.1 # via # mike # mkdocs -regex==2025.9.1 - # via mkdocs-material requests==2.32.5 # via mkdocs-material six==1.17.0 @@ -211,6 +196,13 @@ tinycss2==1.4.0 # via # cairosvg # cssselect2 +typing-extensions==4.14.1 + # via + # pydantic + # pydantic-core + # typing-inspection +typing-inspection==0.4.1 + # via pydantic urllib3==2.5.0 # via requests verspec==0.1.0 @@ -218,7 +210,9 @@ verspec==0.1.0 watchdog==6.0.0 # via mkdocs wcmatch==10.1 - # via mkdocs-include-markdown-plugin + # via + # mkdocs-awesome-nav + # mkdocs-include-markdown-plugin webencodings==0.5.1 # via # cssselect2