diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27001fb..060bcb1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -68,6 +68,10 @@ repos: files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict + - repo: https://github.com/pappasam/toml-sort + rev: v0.24.2 + hooks: + - id: toml-sort-fix - repo: https://github.com/psf/black rev: 24.10.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index c0a59bb..db35d86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,12 @@ [build-system] +build-backend = "setuptools.build_meta" requires = [ "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] -# https://peps.python.org/pep-0621/#readme -requires-python = ">=3.9" -dynamic = ["version", "dependencies", "optional-dependencies"] -name = "ansible-compat" -description = "Ansible compatibility goodies" -readme = "README.md" -authors = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }] -maintainers = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }] -license = { text = "MIT" } +authors = [{"email" = "ssbarnea@redhat.com", "name" = "Sorin Sbarnea"}] classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -36,52 +28,60 @@ classifiers = [ "Topic :: Software Development :: Testing", "Topic :: Utilities" ] +description = "Ansible compatibility goodies" +dynamic = ["version", "dependencies", "optional-dependencies"] keywords = ["ansible"] +license = {text = "MIT"} +maintainers = [{"email" = "ssbarnea@redhat.com", "name" = "Sorin Sbarnea"}] +name = "ansible-compat" +readme = "README.md" +# https://peps.python.org/pep-0621/#readme +requires-python = ">=3.9" [project.urls] -homepage = "https://github.com/ansible/ansible-compat" +changelog = "https://github.com/ansible/ansible-compat/releases" documentation = "https://ansible.readthedocs.io/projects/compat/" +homepage = "https://github.com/ansible/ansible-compat" repository = "https://github.com/ansible/ansible-compat" -changelog = "https://github.com/ansible/ansible-compat/releases" [tool.coverage.report] -exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"] +exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"] fail_under = 100 -skip_covered = true show_missing = true +skip_covered = true [tool.coverage.run] -source = ["src"] # Do not use branch until bug is fixes: # https://github.com/nedbat/coveragepy/issues/605 branch = false -parallel = true concurrency = ["multiprocessing", "thread"] +parallel = true +source = ["src"] [tool.isort] profile = "black" [tool.mypy] -python_version = 3.9 color_output = true -error_summary = true +disallow_any_generics = true disallow_untyped_calls = true disallow_untyped_defs = true -disallow_any_generics = true +error_summary = true # disallow_any_unimported = True # ; warn_redundant_casts = True # warn_return_any = True # warn_unused_configs = True exclude = "test/local-content" +python_version = "3.9" [[tool.mypy.overrides]] -module = "ansible.*" ignore_missing_imports = true +module = "ansible.*" [[tool.mypy.overrides]] +ignore_errors = true # generated by setuptools-scm, can be missing during linting module = "ansible_compat._version" -ignore_errors = true [tool.pydoclint] allow-init-docstring = true @@ -362,11 +362,15 @@ filterwarnings = [ testpaths = ["test"] [tool.ruff] -preview = true extend-include = ["src/ansible_compat/_version.py"] +preview = true target-version = "py39" -lint.select = ["ALL"] -lint.ignore = [ + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +ignore = [ # Disabled on purpose: "CPY001", "D203", # incompatible with D211 @@ -384,9 +388,7 @@ lint.ignore = [ "PLC0415", "DOC501" # preview ] - -[tool.ruff.format] -docstring-code-format = true +select = ["ALL"] [tool.ruff.lint.flake8-pytest-style] parametrize-values-type = "tuple" @@ -401,16 +403,12 @@ known-third-party = ["packaging"] [tool.ruff.lint.pydocstyle] convention = "google" - [tool.setuptools.dynamic] -dependencies = { file = [".config/requirements.in"] } -optional-dependencies.docs = { file = [".config/requirements-docs.in"] } -optional-dependencies.test = { file = [".config/requirements-test.in"] } +dependencies = {file = [".config/requirements.in"]} +optional-dependencies.docs = {file = [".config/requirements-docs.in"]} +optional-dependencies.test = {file = [".config/requirements-test.in"]} [tool.setuptools_scm] -local_scheme = "no-local-version" -tag_regex = "^(?Pv)?(?P\\d+[^\\+]*)(?P.*)?$" -write_to = "src/ansible_compat/_version.py" # To prevent accidental pick of mobile version tags such 'v6' git_describe_command = [ "git", @@ -421,8 +419,16 @@ git_describe_command = [ "--match", "v*.*" ] +local_scheme = "no-local-version" +tag_regex = "^(?Pv)?(?P\\d+[^\\+]*)(?P.*)?$" +write_to = "src/ansible_compat/_version.py" + +[tool.tomlsort] +in_place = true +sort_inline_tables = true +sort_table_keys = true [tool.uv.pip] annotation-style = "line" -no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv"] custom-compile-command = "tox run deps" +no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv"]