diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ea9c75..2c8fd14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,10 +7,21 @@ repos: - id: check-added-large-files - id: check-case-conflict - id: check-merge-conflict + - id: check-yaml + - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace - id: debug-statements - id: detect-private-key + - repo: https://github.com/tox-dev/tox-ini-fmt + rev: "1.3.1" + hooks: + - id: tox-ini-fmt + - repo: https://github.com/tox-dev/pyproject-fmt + rev: "1.5.3" + hooks: + - id: pyproject-fmt + additional_dependencies: ["tox>=4.9"] - repo: https://github.com/adamchainz/django-upgrade rev: 1.13.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 30c77dc..944a427 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,9 @@ [build-system] -requires = ["setuptools>=67.3.2", "wheel"] build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=67.3.2", + "wheel", +] [tool.black] line-length = 88 @@ -88,6 +91,17 @@ exclude_lines = [ "if TYPE_CHECKING:", ] +[[tool.mypy.overrides]] +module = [ + "*.migrations.*", +] +ignore_errors = true + +[[tool.mypy.overrides]] +module = [ + "parameterized.*", +] +ignore_missing_imports = true [tool.mypy] python_version = "3.10" pretty = true @@ -114,15 +128,3 @@ plugins = ["mypy_django_plugin.main"] [tool.django-stubs] django_settings_module = "tests.settings" - -[[tool.mypy.overrides]] -module = [ - "*.migrations.*", -] -ignore_errors = true - -[[tool.mypy.overrides]] -module = [ - "parameterized.*", -] -ignore_missing_imports = true diff --git a/tox.ini b/tox.ini index 0a3c129..74ccfc2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,60 +1,65 @@ [tox] -envlist = - django42-py{312,311,310,39} - django41-py{ 311,310,39} - django40-py{ 311,310,39} - django32-py{ 310,39} +requires = + tox>=4.2 +env_list = + django42-py{312, 311, 310, 39} + django41-py{311, 310, 39} + django40-py{311, 310, 39} + django32-py{310, 39} mypy check-migrations -skipsdist = true - -[pytest] -django_find_project = false -pythonpath = . +no_package = true [testenv] -passenv = TERM deps = .[test] + django_main: {[django]main} + django32: {[django]3-2-x} django40: {[django]4-0-x} django41: {[django]4-1-x} django42: {[django]4-2-x} - django32: {[django]3-2-x} - django_main: {[django]main} -commands = pytest --ds=tests.settings --cov --no-cov-on-fail --cov-report xml --cov-report term-missing {posargs} -usedevelop = false - -[django] -main = - https://github.com/django/django/tarball/main -4-2-x = - Django>=4.2,<5.0 -4-1-x = - Django>=4.1,<4.2 -4-0-x = - Django>=4.0,<4.1 -3-2-x = - Django>=3.2,<4.0 +pass_env = + TERM +commands = + pytest --ds=tests.settings --cov --no-cov-on-fail --cov-report xml --cov-report term-missing {posargs} [testenv:mypy] deps = - .[test] - mypy {[django]3-2-x} + .[test] django-stubs -commands = mypy --strict src/ tests/ + mypy +commands = + mypy --strict src/ tests/ [testenv:check-migrations] -setenv = - PYTHONPATH={toxinidir} - DJANGO_SETTINGS_MODULE=tests.settings deps = - .[test] {[django]3-2-x} -commands = django-admin makemigrations --check --dry-run + .[test] +set_env = + DJANGO_SETTINGS_MODULE = tests.settings + PYTHONPATH = {toxinidir} +commands = + django-admin makemigrations --check --dry-run [testenv:dev] +package = editable deps = - .[test] {[django]3-2-x} -usedevelop = true + .[test] + +[pytest] +django_find_project = false +pythonpath = . + +[django] +main = + https://github.com/django/django/tarball/main +4-2-x = + Django>=4.2,<5.0 +4-1-x = + Django>=4.1,<4.2 +4-0-x = + Django>=4.0,<4.1 +3-2-x = + Django>=3.2,<4.0