From 9681d30788d91b9568f5d9504a67707b1f65dbda Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Sat, 18 May 2024 07:12:25 -0400 Subject: [PATCH] Upgrade to pyproject-fmt version 2. --- .pre-commit-config.yaml | 4 +- pyproject.toml | 128 +++++++++++++++++++++------------------- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3512882..3eed040 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,10 @@ repos: - repo: https://github.com/tox-dev/pyproject-fmt - rev: "1.7.0" + rev: "2.1.1" hooks: - id: pyproject-fmt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.2 + rev: v0.4.4 hooks: - id: ruff-format - id: ruff diff --git a/pyproject.toml b/pyproject.toml index 5da0176..2dc7a19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,9 +9,9 @@ requires = [ [project] name = "jinjanator-plugin-ansible" description = "Plugin which provides Ansible filters and tests to the jinjanator tool" -license = { text="Apache-2.0" } +license = { text = "Apache-2.0" } authors = [ - { name="Kevin P. Fleming", email="jinjanator@kevin.km6g.us" }, + { name = "Kevin P. Fleming", email = "jinjanator@kevin.km6g.us" }, ] requires-python = ">=3.9" classifiers = [ @@ -36,11 +36,9 @@ dependencies = [ "ansible-core", "jinjanator-plugins==24.1.*", ] -[project.urls] -"Bug Tracker" = "https://github.com/kpfleming/jinjanator-plugin-ansible/issues" -"Homepage" = "https://github.com/kpfleming/jinjanator-plugin-ansible" -[project.entry-points.jinjanator] -ansible = "jinjanator_plugin_ansible.plugin" +urls."Bug Tracker" = "https://github.com/kpfleming/jinjanator-plugin-ansible/issues" +urls."Homepage" = "https://github.com/kpfleming/jinjanator-plugin-ansible" +entry-points.jinjanator.ansible = "jinjanator_plugin_ansible.plugin" [tool.hatch.envs.changelog] skip-install = true @@ -69,14 +67,14 @@ exclude = [ [tool.hatch.build.targets.sdist] include = [ - "src", - "tests", - "*.md", + "src", + "tests", + "*.md", ] [tool.hatch.build.targets.wheel] packages = [ - "src/jinjanator_plugin_ansible", + "src/jinjanator_plugin_ansible", ] [tool.hatch.envs.default] @@ -84,51 +82,51 @@ python = "3.12" [tool.hatch.envs.lint] dependencies = [ - "ruff>=0.2.0", - "mypy", - "pyproject-fmt", + "ruff>=0.2.0", + "mypy", + "pyproject-fmt", ] [tool.hatch.envs.lint.scripts] lint = [ - "ruff format", - "ruff check --output-format=full --fix --show-fixes", - "mypy --package jinjanator_plugin_ansible", - "mypy tests", - "shellcheck workflow-support/*.sh", - "pyproject-fmt pyproject.toml", + "ruff format", + "ruff check --output-format=full --fix --show-fixes", + "mypy --package jinjanator_plugin_ansible", + "mypy tests", + "shellcheck workflow-support/*.sh", + "pyproject-fmt pyproject.toml", ] lint-action = [ - "ruff format --check --diff", - "ruff check --output-format=github", - "mypy --package jinjanator_plugin_ansible", - "mypy tests", - "shellcheck workflow-support/*.sh", - "pyproject-fmt --check pyproject.toml", + "ruff format --check --diff", + "ruff check --output-format=github", + "mypy --package jinjanator_plugin_ansible", + "mypy tests", + "shellcheck workflow-support/*.sh", + "pyproject-fmt --check pyproject.toml", ] [tool.hatch.envs.ci] dependencies = [ - "coverage[toml]", - "pytest", - "pytest-cov", - "pytest-icdiff", + "coverage[toml]", + "pytest", + "pytest-cov", + "pytest-icdiff", ] [[tool.hatch.envs.ci.matrix]] python = [ -"3.9", -"3.10", -"3.11", -"3.12", -"3.13", + "3.9", + "3.10", + "3.11", + "3.12", + "3.13", ] [tool.hatch.envs.ci.scripts] ci = [ - "rm -f .coverage", - "pytest --verbose --cov-append --cov-branch --cov=jinjanator_plugin_ansible", - "coverage report --show-missing --fail-under=100", + "rm -f .coverage", + "pytest --verbose --cov-append --cov-branch --cov=jinjanator_plugin_ansible", + "coverage report --show-missing --fail-under=100", ] [tool.hatch.metadata] @@ -173,44 +171,46 @@ pattern = "#(\\d+)" replacement = "[#\\1](https://github.com/kpfleming/jinjanator-plugin-ansible/issues/\\1)" [tool.ruff] -src = ["src", "tests"] line-length = 100 -[tool.ruff.lint] -ignore-init-module-imports = true -select = ["ALL"] -ignore = [ - "ANN", # Mypy is better at this. - "COM812", # conflicts with formatter - "C901", # Leave complexity to me. - "D", # We have different ideas about docstrings. - "ISC001", # conflicts with formatter - "PLR0912", # Leave complexity to me. - "TRY301", # Raise in try blocks can totally make sense. +src = [ + "src", + "tests", ] -unfixable = ["F401"] - -[tool.ruff.lint.per-file-ignores] -"tests/*" = [ +lint.select = [ + "ALL", +] +lint.per-file-ignores."tests/*" = [ "PLC1901", # empty strings are falsey, but are less specific in tests "PT005", # we use always underscores and explicit names "S101", # assert "SIM300", # Yoda rocks in tests ] - -[tool.ruff.lint.isort] -lines-between-types = 1 -lines-after-imports = 2 +lint.unfixable = [ + "F401", +] +lint.isort.lines-after-imports = 2 +lint.isort.lines-between-types = 1 +lint.ignore = [ + "ANN", # Mypy is better at this. + "C901", # Leave complexity to me. + "COM812", # conflicts with formatter + "D", # We have different ideas about docstrings. + "ISC001", # conflicts with formatter + "PLR0912", # Leave complexity to me. + "TRY301", # Raise in try blocks can totally make sense. +] +lint.ignore-init-module-imports = true [tool.pytest.ini_options] minversion = "6.0" xfail_strict = true testpaths = [ - "tests", + "tests", ] addopts = [ - "-ra", - "--strict-markers", + "-ra", + "--strict-markers", ] [tool.towncrier] @@ -222,7 +222,11 @@ start_string = "\n" template = "changelog.d/towncrier_template.md.jinja" title_format = "" issue_format = "[#{issue}](https://github.com/kpfleming/jinjanator-plugin-ansible/issues/{issue})" -underlines = ["", "", ""] +underlines = [ + "", + "", + "", +] [[tool.towncrier.section]] path = ""