chore: remove hatch for building docs

This commit is contained in:
Juro Oravec 2025-08-18 12:39:48 +02:00
parent 7b62cdbc8e
commit 3cca648f61
4 changed files with 132 additions and 152 deletions

View file

@ -58,8 +58,8 @@ jobs:
python -m pip install --upgrade pip wheel python -m pip install --upgrade pip wheel
# NOTE: pin virtualenv to <20.31 until asv fixes it. # NOTE: pin virtualenv to <20.31 until asv fixes it.
# See https://github.com/airspeed-velocity/asv/issues/1484 # See https://github.com/airspeed-velocity/asv/issues/1484
python -m pip install -q hatch pre-commit asv virtualenv==20.30 python -m pip install -q pre-commit asv virtualenv==20.30
hatch --version python -m pip install -r requirements-docs.txt
########################################### ###########################################
# RECORD BENCHMARK - ONLY ON PUSH TO MASTER # RECORD BENCHMARK - ONLY ON PUSH TO MASTER
@ -166,9 +166,9 @@ jobs:
- name: Check docs in pull requests with strict mode - name: Check docs in pull requests with strict mode
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
run: | run: |
# XXX Enable strict mode once docs are clean # TODO: Enable strict mode once docs are clean
echo "Strict check of docs disabled." 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 - name: Build & deploy "dev" docs for a new commit to master
if: github.event_name == 'push' && github.ref_type != 'tag' if: github.event_name == 'push' && github.ref_type != 'tag'
@ -180,7 +180,7 @@ jobs:
git checkout master git checkout master
export SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7) 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 - name: Build & deploy docs for a new tag
if: github.ref_type == 'tag' && github.event_name == 'push' if: github.ref_type == 'tag' && github.event_name == 'push'
@ -191,5 +191,5 @@ jobs:
git pull origin gh-pages git pull origin gh-pages
git checkout master git checkout master
hatch run docs:mike deploy --push --update-aliases ${{ github.ref_name }} latest python -m mike deploy --push --update-aliases ${{ github.ref_name }} latest
hatch run docs:mike set-default latest --push python -m mike set-default latest --push

View file

@ -44,6 +44,10 @@ Issues = "https://github.com/django-components/django-components/issues"
Donate = "https://github.com/sponsors/EmilStenstrom" Donate = "https://github.com/sponsors/EmilStenstrom"
###########################################
# TOOLS
###########################################
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["src"] where = ["src"]
include = ["django_components*"] include = ["django_components*"]
@ -86,61 +90,61 @@ exclude = [
select = ["ALL"] select = ["ALL"]
ignore = [ ignore = [
# Annotations # Annotations
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `*args` "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `*args`
# Docstring # Docstring
"D100", # Missing docstring in public module "D100", # Missing docstring in public module
"D101", # Missing docstring in public class "D101", # Missing docstring in public class
"D102", # Missing docstring in public method "D102", # Missing docstring in public method
"D103", # Missing docstring in public function "D103", # Missing docstring in public function
"D104", # Missing docstring in public package "D104", # Missing docstring in public package
"D105", # Missing docstring in magic method "D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class "D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__` "D107", # Missing docstring in `__init__`
"D203", # Incorrect blank line before class "D203", # Incorrect blank line before class
"D205", # 1 blank line required between summary line and description "D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line "D212", # Multi-line docstring summary should start at the first line
"D400", # First line should end with a period "D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood "D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This" "D404", # First word of the docstring should not be "This"
"D412", # No blank lines allowed between a section header and its content ("Examples") "D412", # No blank lines allowed between a section header and its content ("Examples")
"D415", # First line should end with a period, question mark, or exclamation point "D415", # First line should end with a period, question mark, or exclamation point
# Exceptions # Exceptions
"EM101", # Exception must not use a string literal, assign to variable first "EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first "EM102", # Exception must not use an f-string literal, assign to variable first
# `TODO` comments # `TODO` comments
"FIX002", # Line contains TODO, consider resolving the issue "FIX002", # Line contains TODO, consider resolving the issue
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...` "TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link for this TODO "TD003", # Missing issue link for this TODO
"TD004", # Missing colon in TODO "TD004", # Missing colon in TODO
# Code # Code
"C901", # `test_result_interception` is too complex (36 > 10) "C901", # `test_result_interception` is too complex (36 > 10)
"COM812", # missing-trailing-comma (NOTE: Already handled by formatter) "COM812", # missing-trailing-comma (NOTE: Already handled by formatter)
"ERA001", # Found commented-out code (NOTE: Too many false positives) "ERA001", # Found commented-out code (NOTE: Too many false positives)
"INP001", # File `...` is part of an implicit namespace package. Add an `__init__.py`. "INP001", # File `...` is part of an implicit namespace package. Add an `__init__.py`.
"PLR0915", # Too many statements (64 > 50) "PLR0915", # Too many statements (64 > 50)
"PLR0911", # Too many return statements (7 > 6) "PLR0911", # Too many return statements (7 > 6)
"PLR0912", # Too many branches (31 > 12) "PLR0912", # Too many branches (31 > 12)
"PLR0913", # Too many arguments in function definition (6 > 5) "PLR0913", # Too many arguments in function definition (6 > 5)
"PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable "PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable
"RET504", # Unnecessary assignment to `collected` before `return` statement "RET504", # Unnecessary assignment to `collected` before `return` statement
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities "S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
"S603", # `subprocess` call: check for execution of untrusted input "S603", # `subprocess` call: check for execution of untrusted input
"SIM108", # Use ternary operator `...` instead of `if`-`else`-block "SIM108", # Use ternary operator `...` instead of `if`-`else`-block
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements "SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF001", # Private member accessed: `_registry` "SLF001", # Private member accessed: `_registry`
"TRY300", # Consider moving this statement to an `else` block "TRY300", # Consider moving this statement to an `else` block
# TODO: Following could be useful to start using, but might require more changes. # TODO: Following could be useful to start using, but might require more changes.
"C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead "C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
"PERF401", # Use `list.extend` to create a transformed list "PERF401", # Use `list.extend` to create a transformed list
"PERF203", # `try`-`except` within a loop incurs performance overhead "PERF203", # `try`-`except` within a loop incurs performance overhead
"FBT001", # Boolean-typed positional argument in function definition "FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition "FBT002", # Boolean default positional argument in function definition
"TRY003", # Avoid specifying long messages outside the exception class "TRY003", # Avoid specifying long messages outside the exception class
# TODO - Enable FA100 once we drop support for Python 3.8 # TODO - Enable FA100 once we drop support for Python 3.8
"FA100", # Add `from __future__ import annotations` to simplify `typing.Optional` "FA100", # Add `from __future__ import annotations` to simplify `typing.Optional`
# TODO_V1 - Rename error to suffix with `Error` before v1? # TODO_V1 - Rename error to suffix with `Error` before v1?
"N818", # Exception name `NotRegistered` should be named with an Error suffix "N818", # Exception name `NotRegistered` should be named with an Error suffix
] ]
[tool.ruff.lint.isort] [tool.ruff.lint.isort]
@ -149,37 +153,34 @@ known-first-party = ["django_components"]
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"tests/*" = [ "tests/*" = [
"ARG002", # Unused method argument: `components_settings` "ARG002", # Unused method argument: `components_settings`
"ANN", # Annotations are not needed for tests "ANN", # Annotations are not needed for tests
"N806", # Variable `SimpleComponent` in function should be lowercase "N806", # Variable `SimpleComponent` in function should be lowercase
"PLC0415", # `import` should be at the top-level of a file "PLC0415", # `import` should be at the top-level of a file
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` "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 "TRY002", # Create your own exception
] ]
"benchmarks/*" = [ "benchmarks/*" = [
"ARG002", # Unused method argument: `components_settings` "ARG002", # Unused method argument: `components_settings`
"ANN", # Annotations are not needed for tests "ANN", # Annotations are not needed for tests
"N806", # Variable `SimpleComponent` in function should be lowercase "N806", # Variable `SimpleComponent` in function should be lowercase
"PLC0415", # `import` should be at the top-level of a file "PLC0415", # `import` should be at the top-level of a file
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` "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 "TRY002", # Create your own exception
] ]
"sampleproject/*" = [ "sampleproject/*" = [
"ARG002", # Unused method argument "ARG002", # Unused method argument
"ANN", # Annotations are not needed for tests "ANN", # Annotations are not needed for tests
"T201", # `print` found "T201", # `print` found
"DTZ", # `datetime` found "DTZ", # `datetime` found
] ]
[tool.mypy] [tool.mypy]
check_untyped_defs = true check_untyped_defs = true
ignore_missing_imports = true ignore_missing_imports = true
exclude = [ exclude = ["test_structures", "build"]
"test_structures",
"build",
]
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = "django_components.*" module = "django_components.*"
@ -187,40 +188,5 @@ disallow_untyped_defs = true
[tool.pytest.ini_options] [tool.pytest.ini_options]
testpaths = [ testpaths = ["tests"]
"tests",
]
asyncio_mode = "auto" 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"

20
requirements-docs.in Normal file
View file

@ -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

View file

@ -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 # pip-compile requirements-docs.in
# - 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
# #
annotated-types==0.7.0
# via pydantic
asgiref==3.9.1 asgiref==3.9.1
# via django # via django
babel==2.17.0 babel==2.17.0
# via # via
# mkdocs-git-revision-date-localized-plugin # mkdocs-git-revision-date-localized-plugin
# mkdocs-material # mkdocs-material
backrefs==5.9
# via mkdocs-material
bracex==2.6 bracex==2.6
# via wcmatch # via wcmatch
cairocffi==1.7.1 cairocffi==1.7.1
@ -41,9 +26,10 @@ cffi==1.17.1
# via cairocffi # via cairocffi
charset-normalizer==3.4.3 charset-normalizer==3.4.3
# via requests # via requests
click==8.1.8 click==8.2.1
# via # via
# mkdocs # mkdocs
# mkdocs-material
colorama==0.4.6 colorama==0.4.6
# via # via
# griffe # griffe
@ -54,17 +40,17 @@ cssselect2==0.8.0
# via cairosvg # via cairosvg
defusedxml==0.7.1 defusedxml==0.7.1
# via cairosvg # via cairosvg
django==4.2.23 django==5.2.5
# via hatch.envs.docs # via -r requirements-docs.in
djc-core-html-parser==1.0.2 djc-core-html-parser==1.0.2
# via hatch.envs.docs # via -r requirements-docs.in
ghp-import==2.1.0 ghp-import==2.1.0
# via mkdocs # via mkdocs
gitdb==4.0.12 gitdb==4.0.12
# via gitpython # via gitpython
gitpython==3.1.45 gitpython==3.1.45
# via mkdocs-git-revision-date-localized-plugin # via mkdocs-git-revision-date-localized-plugin
griffe==1.11.1 griffe==1.12.1
# via mkdocstrings-python # via mkdocstrings-python
htmlmin2==0.1.13 htmlmin2==0.1.13
# via mkdocs-minify-plugin # via mkdocs-minify-plugin
@ -90,7 +76,7 @@ markdown==3.8.2
# mkdocstrings # mkdocstrings
# pymdown-extensions # pymdown-extensions
markdown-exec==1.11.0 markdown-exec==1.11.0
# via hatch.envs.docs # via -r requirements-docs.in
markupsafe==3.0.2 markupsafe==3.0.2
# via # via
# jinja2 # jinja2
@ -102,10 +88,10 @@ mergedeep==1.3.4
# mkdocs # mkdocs
# mkdocs-get-deps # mkdocs-get-deps
mike==2.1.3 mike==2.1.3
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs==1.6.1 mkdocs==1.6.1
# via # via
# hatch.envs.docs # -r requirements-docs.in
# mike # mike
# mkdocs-autorefs # mkdocs-autorefs
# mkdocs-awesome-nav # mkdocs-awesome-nav
@ -119,64 +105,65 @@ mkdocs==1.6.1
# mkdocstrings # mkdocstrings
mkdocs-autorefs==1.4.2 mkdocs-autorefs==1.4.2
# via # via
# hatch.envs.docs # -r requirements-docs.in
# mkdocstrings # mkdocstrings
# mkdocstrings-python # mkdocstrings-python
mkdocs-awesome-nav==3.0.0 mkdocs-awesome-nav==3.1.2
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-gen-files==0.5.0 mkdocs-gen-files==0.5.0
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-get-deps==0.2.0 mkdocs-get-deps==0.2.0
# via # via mkdocs
# mkdocs
# mkdocstrings
mkdocs-git-authors-plugin==0.10.0 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 mkdocs-git-revision-date-localized-plugin==1.4.7
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-include-markdown-plugin==7.1.6 mkdocs-include-markdown-plugin==7.1.6
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-material==9.6.16 mkdocs-material[imaging]==9.6.17
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-material-extensions==1.3.1 mkdocs-material-extensions==1.3.1
# via mkdocs-material # via mkdocs-material
mkdocs-minify-plugin==0.8.0 mkdocs-minify-plugin==0.8.0
# via hatch.envs.docs # via -r requirements-docs.in
mkdocs-redirects==1.2.2 mkdocs-redirects==1.2.2
# via hatch.envs.docs # via -r requirements-docs.in
mkdocstrings==0.30.0 mkdocstrings==0.30.0
# via # via
# hatch.envs.docs # -r requirements-docs.in
# mkdocstrings-python # mkdocstrings-python
mkdocstrings-python==1.16.12 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 packaging==25.0
# via # via mkdocs
# mkdocs
paginate==0.5.7 paginate==0.5.7
# via mkdocs-material # via mkdocs-material
pathspec==0.12.1 pathspec==0.12.1
# via # via mkdocs
# mkdocs pillow==10.4.0
pillow==11.3.0
# via # via
# cairosvg # cairosvg
# mkdocs-material # mkdocs-material
platformdirs==4.3.8 platformdirs==4.3.8
# via # via mkdocs-get-deps
# mkdocs-get-deps
pycparser==2.22 pycparser==2.22
# via cffi # via cffi
pydantic==2.11.7
# via mkdocs-awesome-nav
pydantic-core==2.33.2
# via pydantic
pygments==2.19.2 pygments==2.19.2
# via # via
# hatch.envs.docs # -r requirements-docs.in
# mkdocs-material # mkdocs-material
# pygments-djc # pygments-djc
pygments-djc==1.0.1 pygments-djc==1.0.1
# via hatch.envs.docs # via -r requirements-docs.in
pymdown-extensions==10.16.1 pymdown-extensions==10.16.1
# via # via
# hatch.envs.docs # -r requirements-docs.in
# markdown-exec # markdown-exec
# mkdocs-material # mkdocs-material
# mkdocstrings # mkdocstrings
@ -197,8 +184,6 @@ pyyaml-env-tag==1.1
# via # via
# mike # mike
# mkdocs # mkdocs
regex==2025.7.34
# via mkdocs-material
requests==2.32.4 requests==2.32.4
# via mkdocs-material # via mkdocs-material
six==1.17.0 six==1.17.0
@ -211,6 +196,13 @@ tinycss2==1.4.0
# via # via
# cairosvg # cairosvg
# cssselect2 # cssselect2
typing-extensions==4.14.1
# via
# pydantic
# pydantic-core
# typing-inspection
typing-inspection==0.4.1
# via pydantic
urllib3==2.5.0 urllib3==2.5.0
# via requests # via requests
verspec==0.1.0 verspec==0.1.0
@ -218,7 +210,9 @@ verspec==0.1.0
watchdog==6.0.0 watchdog==6.0.0
# via mkdocs # via mkdocs
wcmatch==10.1 wcmatch==10.1
# via mkdocs-include-markdown-plugin # via
# mkdocs-awesome-nav
# mkdocs-include-markdown-plugin
webencodings==0.5.1 webencodings==0.5.1
# via # via
# cssselect2 # cssselect2