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

View file

@ -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*"]
@ -86,61 +90,61 @@ exclude = [
select = ["ALL"]
ignore = [
# Annotations
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `*args`
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `*args`
# Docstring
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D203", # Incorrect blank line before class
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"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
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D203", # Incorrect blank line before class
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"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
# Exceptions
"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
"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
# `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>: ...`
"TD003", # Missing issue link for this TODO
"TD004", # Missing colon in TODO
# 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)
"ERA001", # Found commented-out code (NOTE: Too many false positives)
"INP001", # File `...` is part of an implicit namespace package. Add an `__init__.py`.
"PLR0915", # Too many statements (64 > 50)
"PLR0911", # Too many return statements (7 > 6)
"PLR0912", # Too many branches (31 > 12)
"PLR0913", # Too many arguments in function definition (6 > 5)
"PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable
"PLR0915", # Too many statements (64 > 50)
"PLR0911", # Too many return statements (7 > 6)
"PLR0912", # Too many branches (31 > 12)
"PLR0913", # Too many arguments in function definition (6 > 5)
"PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable
"RET504", # Unnecessary assignment to `collected` before `return` statement
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
"S603", # `subprocess` call: check for execution of untrusted input
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
"S603", # `subprocess` call: check for execution of untrusted input
"SIM108", # Use ternary operator `...` instead of `if`-`else`-block
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF001", # Private member accessed: `_registry`
"TRY300", # Consider moving this statement to an `else` block
# TODO: Following could be useful to start using, but might require more changes.
"C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
"PERF401", # Use `list.extend` to create a transformed list
"PERF203", # `try`-`except` within a loop incurs performance overhead
"C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
"PERF401", # Use `list.extend` to create a transformed list
"PERF203", # `try`-`except` within a loop incurs performance overhead
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"TRY003", # Avoid specifying long messages outside the exception class
# 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?
"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]
@ -149,37 +153,34 @@ 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.mypy]
check_untyped_defs = true
ignore_missing_imports = true
exclude = [
"test_structures",
"build",
]
exclude = ["test_structures", "build"]
[[tool.mypy.overrides]]
module = "django_components.*"
@ -187,40 +188,5 @@ disallow_untyped_defs = true
[tool.pytest.ini_options]
testpaths = [
"tests",
]
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"

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
# - 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,17 +40,17 @@ cssselect2==0.8.0
# via cairosvg
defusedxml==0.7.1
# via cairosvg
django==4.2.23
# 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
# via gitpython
gitpython==3.1.45
# via mkdocs-git-revision-date-localized-plugin
griffe==1.11.1
griffe==1.12.1
# via mkdocstrings-python
htmlmin2==0.1.13
# via mkdocs-minify-plugin
@ -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,64 +105,65 @@ 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
# via -r requirements-docs.in
mkdocs-include-markdown-plugin==7.1.6
# via hatch.envs.docs
mkdocs-material==9.6.16
# via hatch.envs.docs
# via -r requirements-docs.in
mkdocs-material[imaging]==9.6.17
# via -r requirements-docs.in
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.16.12
# via hatch.envs.docs
mkdocstrings-python==1.17.0
# 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
pillow==11.3.0
# via mkdocs
pillow==10.4.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.7.34
# via mkdocs-material
requests==2.32.4
# 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