diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e45ef7d..2320cfd0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v2.19.1 + rev: v2.19.4 hooks: - id: pyupgrade name: PyUpgrade 3.6+ @@ -31,7 +31,7 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 21.5b2 + rev: 21.6b0 hooks: - id: black @@ -42,17 +42,28 @@ repos: stages: [manual] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.902 hooks: - id: mypy exclude: ^(bin/|cibuildwheel/resources/).*py$ - additional_dependencies: [packaging] - args: ["--python-version=3.6", "--ignore-missing-imports", "--scripts-are-modules"] + args: ["--python-version=3.6", "--scripts-are-modules"] + additional_dependencies: + - packaging + - types-jinja2 + - types-certifi + - types-toml - id: mypy name: mypy 3.7+ on bin/ files: ^bin/.*py$ - additional_dependencies: [packaging] - args: ["--python-version=3.7", "--ignore-missing-imports", "--scripts-are-modules"] + args: ["--python-version=3.7", "--scripts-are-modules"] + additional_dependencies: + - packaging + - rich + - types-jinja2 + - types-pyyaml + - types-click + - types-requests + - types-toml - repo: https://github.com/PyCQA/flake8 rev: 3.9.2 diff --git a/pyproject.toml b/pyproject.toml index 386fb3e1..f51ad0ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,66 @@ requires = [ build-backend = "setuptools.build_meta" + [tool.black] line-length = 100 target-version = ['py36', 'py37', 'py38', 'py39'] + + +[tool.isort] +profile = "black" +multi_line_output = 3 + + +[tool.pytest.ini_options] +junit_family = "xunit2" +testpaths = [ + "test", + "unit_test", +] + + +[tool.mypy] +minversion = 6.0 +python_version = 3.7 +files = [ + "cibuildwheel/*.py", + "test/**/*.py", + "unit_test/**/*.py", + "bin/*.py" +] +warn_unused_configs = true +warn_redundant_casts = true + +# Don't require typed functions for tests +[[tool.mypy.overrides]] +module = ["test", "unit_test"] +check_untyped_defs = true + +[[tool.mypy.overrides]] +module = "cibuildwheel" +disallow_any_generics = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +check_untyped_defs = true +disallow_untyped_decorators = true +no_implicit_optional = true +warn_unused_ignores = true +warn_return_any = true +no_implicit_reexport = true +strict_equality = true + +[[tool.mypy.overrides]] +module = [ + "setuptools", + "pytest", # ignored in pre-commit to speed up check + "bashlex", + "toml.encoder", # missing from stub package + "bracex", + "importlib_resources", + "nox", + "github", +] +ignore_missing_imports = true diff --git a/setup.cfg b/setup.cfg index 4c6cecf8..9e3fc215 100644 --- a/setup.cfg +++ b/setup.cfg @@ -65,57 +65,3 @@ exclude = env??/, .venv/, site/ - -[tool:pytest] -junit_family = xunit2 -testpaths = - test - unit_test - -[mypy] -python_version = 3.7 -files = cibuildwheel/*.py,test/**/*.py,unit_test/**/*.py,bin/*.py -warn_unused_configs = True -warn_redundant_casts = True - -[mypy-test.*,mypy-unit_test.*] -check_untyped_defs = True - -[mypy-cibuildwheel.*] -disallow_any_generics = True -disallow_subclassing_any = True -disallow_untyped_calls = True -disallow_untyped_defs = True -disallow_incomplete_defs = True -check_untyped_defs = True -disallow_untyped_decorators = True -no_implicit_optional = True -warn_unused_ignores = True -warn_return_any = True -no_implicit_reexport = True -strict_equality = True - -[mypy-setuptools.*] -ignore_missing_imports = True - -# Ignored for pre-commit to speed up check -# Not ignored if manually running and pytest installed -[mypy-pytest.*] -ignore_missing_imports = True - -[mypy-bashlex.*] -ignore_missing_imports = True - -# Has type stubs, but no pyproject.toml or .pyi files in the wheel. -[mypy-toml.*] -ignore_missing_imports = True - -[mypy-bracex.*] -ignore_missing_imports = True - -[mypy-importlib_resources.*] -ignore_missing_imports = True - -[tool:isort] -profile = black -multi_line_output = 3 diff --git a/setup.py b/setup.py index 690b54eb..4ed6ac54 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ extras = { ], "test": [ "jinja2", - "pytest>=4", + "pytest>=6", "pytest-timeout", ], "bin": [ @@ -24,7 +24,7 @@ extras = { } extras["dev"] = [ - "mypy>=0.800", + "mypy>=0.901", *extras["test"], *extras["bin"], ]