From 23722cdb2535a3e1c859fe236b11a69f38e34b46 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 8 Oct 2024 23:02:53 +0200 Subject: [PATCH] Add a formatter for the pyproject.toml (#435) --- .pre-commit-config.yaml | 6 +++ pyproject.toml | 108 ++++++++++++++++++++-------------------- 2 files changed, 61 insertions(+), 53 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5db5ca4..3b6c601 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,6 +23,12 @@ repos: # see https://stackoverflow.com/a/61046953 exclude: ^pylint_django/tests/input.*$ args: [--safe, --line-length=120] + - repo: https://github.com/tox-dev/pyproject-fmt + rev: "2.2.4" + hooks: + - id: pyproject-fmt + # https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version + additional_dependencies: ["tox>=4.9"] - repo: local hooks: - id: pylint diff --git a/pyproject.toml b/pyproject.toml index c3f2c16..8417184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,41 +1,45 @@ +[build-system] +build-backend = "poetry.core.masonry.api" + +requires = [ "poetry-core>=1" ] + [tool.poetry] name = "pylint-django" version = "2.7.0" readme = "README.rst" description = "A Pylint plugin to help Pylint understand the Django web framework" repository = "https://github.com/PyCQA/pylint-django" -authors = ["Carl Crowder "] +authors = [ "Carl Crowder " ] classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "Operating System :: Unix", - "Topic :: Software Development :: Quality Assurance", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4", - "Framework :: Django :: 4.0", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Operating System :: Unix", + "Topic :: Software Development :: Quality Assurance", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Framework :: Django :: 2.2", + "Framework :: Django :: 3", + "Framework :: Django :: 3.0", + "Framework :: Django :: 3.1", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", ] -keywords = ["pylint", "django", "plugin"] +keywords = [ "pylint", "django", "plugin" ] packages = [ - { include = "pylint_django/" } + { include = "pylint_django/" }, ] -include = ["pylint_django/LICENSE"] -exclude = ["**/tests/**", "**/testutils.py", "**/tests.py"] - +include = [ "pylint_django/LICENSE" ] +exclude = [ "**/tests/**", "**/testutils.py", "**/tests.py" ] [tool.poetry.dependencies] python = ">=3.8,<4.0" @@ -44,7 +48,7 @@ pylint = ">=2.0,<4" Django = { version = ">=2.2", optional = true } [tool.poetry.group.dev.dependencies] -tox = "^4" +tox = ">=4.9" pytest = "^7.3.1" ruff = ">=0.1.1" wheel = "^0.40" @@ -54,15 +58,26 @@ factory-boy = "^3.3" django-tastypie = "^0.14" [tool.poetry.extras] -with_django = ["Django"] - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +with_django = [ "Django" ] [tool.black] line-length = 120 +[tool.ruff] +line-length = 120 +select = [ + "E", # pycodestyle + "F", # pyflakes + "W", # pycodestyle + "B", # bugbear + "I", # isort + "RUF", # ruff + "UP", # pyupgrade +] +ignore = [ + "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` +] + [tool.isort] multi_line_output = 3 include_trailing_comma = true @@ -72,25 +87,12 @@ line_length = 120 [tool.pylint.main] disable = [ - "missing-docstring", - "too-many-branches", "too-many-return-statements", "too-many-ancestors", - "too-few-public-methods", - "fixme", + "missing-docstring", + "too-many-branches", + "too-many-return-statements", + "too-many-ancestors", + "too-few-public-methods", + "fixme", ] ignore = "tests" max-line-length = 120 - -[tool.ruff] -line-length = 120 -select = [ - "E", # pycodestyle - "F", # pyflakes - "W", # pycodestyle - "B", # bugbear - "I", # isort - "RUF", # ruff - "UP", # pyupgrade -] -ignore = [ - "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` -]