Skip to content

Commit

Permalink
Upgrade to pyproject-fmt version 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpfleming committed May 18, 2024
1 parent 87593e2 commit 9681d30
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 64 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
128 changes: 66 additions & 62 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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
Expand Down Expand Up @@ -69,66 +67,66 @@ 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]
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]
Expand Down Expand Up @@ -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]
Expand All @@ -222,7 +222,11 @@ start_string = "<!-- towncrier release notes start -->\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 = ""
Expand Down

0 comments on commit 9681d30

Please sign in to comment.