Skip to content

Commit

Permalink
Build maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Feb 18, 2025
1 parent 8e1e716 commit 8d4b984
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 148 deletions.
3 changes: 3 additions & 0 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cssselect2==0.7.0
defusedxml==0.7.1
dnspython==2.7.0
exceptiongroup==1.2.2
execnet==2.1.1
ghp-import==2.1.0
griffe==1.5.7
hjson==3.1.0
Expand Down Expand Up @@ -55,6 +56,8 @@ pycparser==2.22
pygments==2.19.1
pymdown-extensions==10.14.3
pytest==8.3.4
pytest-plus==0.8.1
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
python-slugify==8.0.4
pyyaml==6.0.2
Expand Down
3 changes: 3 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mkdocstrings
mypy
notest
outdir
posargs
pycontribs
pylint
pymdown
Expand All @@ -44,9 +45,11 @@ pyproject
pyupgrade
ruamel
setuptools
showlocals
smartsymbols
sourcegraph
squidfunk
superfences
tasklist
tomli
tomlsort
2 changes: 2 additions & 0 deletions .config/requirements-test.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
coverage
pytest
pytest-plus
pytest-xdist
52 changes: 31 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ ci:
# format compatible with commitlint
autoupdate_commit_msg: "chore: pre-commit autoupdate"
autoupdate_schedule: monthly
autofix_commit_msg: |
chore: auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_commit_msg: "chore: auto fixes from pre-commit.com hooks"
skip:
# https://github.com/pre-commit-ci/issues/issues/55
- pip-compile
Expand All @@ -15,16 +12,15 @@ repos:
- repo: meta
hooks:
- id: check-useless-excludes
- repo: https://github.com/pre-commit/mirrors-prettier
- repo: https://github.com/rbubley/mirrors-prettier
# keep it before yamllint
rev: v4.0.0-alpha.8
rev: v3.4.2
hooks:
- id: prettier
always_run: true
additional_dependencies:
- prettier
- prettier-plugin-toml
- prettier-plugin-sort-json
- [email protected]
- [email protected]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.17.2
hooks:
Expand All @@ -39,6 +35,11 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
Expand All @@ -64,24 +65,33 @@ repos:
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict
- repo: https://github.com/PyCQA/isort
rev: 6.0.0
hooks:
- id: isort
args:
# https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082
- --filter-files
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/pyupgrade
# keep it after flake8
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py39-plus"]
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
alias: toml

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.5.0
hooks:
- id: tox-ini-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
types_or: [python, pyi]
# - id: ruff-format # must be after ruff
# types_or: [python, pyi]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
Expand Down
10 changes: 10 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[formatting]
# cspell: disable-next-line
# compatibility between toml-sort-fix pre-commit hook and panekj.even-betterer-toml extension
align_comments = false
array_trailing_comma = false
compact_arrays = true
compact_entries = false
compact_inline_tables = true
inline_table_expand = false
reorder_keys = true
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
comment: false
coverage:
status:
patch: true
project:
default:
threshold: 0.5%
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dictionaries:
- bash
- words
- python
enabled: true
ignorePaths:
- cspell.config.yaml
# The requirements file
Expand Down
93 changes: 67 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration
"setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme

"setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs
"setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme
]
build-backend = "setuptools.build_meta"

[project]
requires-python = ">=3.10"
dynamic = ["version", "dependencies", "optional-dependencies"]
name = "mkdocs-ansible"
description = "Ansible MkDocs Theme based on mkdocs-material"
readme = "docs/README.md"
authors = [{ "name" = "Ansible by Red Hat", "email" = "[email protected]" }]
maintainers = [{ "name" = "Ansible by Red Hat", "email" = "[email protected]" }]
license = { text = "MIT" }
authors = [{"email" = "[email protected]", "name" = "Ansible by Red Hat"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
Expand All @@ -28,39 +20,61 @@ classifiers = [
'Programming Language :: Python :: 3.13',
"Topic :: Documentation",
"Topic :: Software Development :: Documentation",
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: Text Processing :: Markup :: HTML"
]
description = "Ansible MkDocs Theme based on mkdocs-material"
dynamic = ["version", "dependencies", "optional-dependencies"]
keywords = ["ansible", "mkdocs", "theme"]
license = {text = "MIT"}
maintainers = [{"email" = "[email protected]", "name" = "Ansible by Red Hat"}]
name = "mkdocs-ansible"
readme = "docs/README.md"
requires-python = ">=3.10"

[project.entry-points."mkdocs.themes"]
ansible = "mkdocs_ansible"

[project.urls]
homepage = "https://github.com/ansible/mkdocs-ansible"
changelog = "https://github.com/ansible/mkdocs-ansible/releases"
documentation = "https://ansible.readthedocs.io/projects/mkdocs-ansible/"
homepage = "https://github.com/ansible/mkdocs-ansible"
repository = "https://github.com/ansible/mkdocs-ansible"
changelog = "https://github.com/ansible/mkdocs-ansible/releases"

[tool.codespell]
# indention is a typo in ruamel.yaml's API
ignore-words-list = "indention"
skip = ".tox,.mypy_cache,build,.git,.eggs,pip-wheel-metadata"

[project.entry-points."mkdocs.themes"]
ansible = "mkdocs_ansible"
# Keep this default because xml/report do not know to use load it from config file:
# data_file = ".coverage"
[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
omit = ["test/*", "src/mkdocs_ansible/_version.py"]
exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"]
# Increase it just so it would pass on any single-python run
fail_under = 82
skip_covered = true
skip_empty = true
# During development we might remove code (files) with coverage data, and we dont want to fail:
ignore_errors = true
omit = ["test/*", "src/mkdocs_ansible/_version.py"]
show_missing = true
skip_covered = true
skip_empty = true

[tool.coverage.run]
concurrency = ["multiprocessing", "thread"]
# Do not use branch until bug is fixes:
# https://github.com/nedbat/coveragepy/issues/605
# branch = true
parallel = true
source = ["src"]

[tool.mypy]
strict = true
exclude = "(.config|build|dist|test/local-content|site-packages|~/.pyenv|examples/playbooks/collections|plugins/modules)"
# https://github.com/python/mypy/issues/12664
python_version = "3.10"
strict = true
warn_unused_configs = true
exclude = ['build']

[[tool.mypy.overrides]]
module = ["mkdocs_ansible._version"]
Expand All @@ -73,19 +87,46 @@ warn_unused_ignores = false # https://github.com/python/mypy/issues/13201
[tool.pylint.MASTER]
ignore-paths = "^src/.*/(_version|_vendor).*$"

[tool.setuptools.dynamic]
dependencies = { file = [".config/requirements.in"] }
optional-dependencies.test = { file = [".config/requirements-test.in"] }
[tool.ruff]
cache-dir = "./.cache/.ruff"
exclude = [".config"]
fix = true
# Same as Black.
line-length = 88
preview = true

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
dependencies = {file = [".config/requirements.in"]}
optional-dependencies.test = {file = [".config/requirements-test.in"]}

[tool.setuptools.package-data]
"*" = ["*.css", "*.html", "*.js"]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]
# To prevent accidental pick of mobile version tags such 'v6'
git_describe_command = [
"git",
"describe",
"--dirty",
"--long",
"--tags",
"--match",
"v*.*"
]
local_scheme = "no-local-version"
tag_regex = "^(?P<prefix>v)?(?P<version>\\d+[^\\+]*)(?P<suffix>.*)?$"
write_to = "src/mkdocs_ansible/_version.py"

[tool.tomlsort]
in_place = true
sort_inline_tables = true
sort_table_keys = true
Loading

0 comments on commit 8d4b984

Please sign in to comment.