Skip to content

Commit

Permalink
chore: update mypy and move to toml (#547)
Browse files Browse the repository at this point in the history
* Updates mypy to 0.950
* Uses pyproject.toml insted of mypy.ini - nicer config, fewer files
* Uses `strict = true` instead of the long list (supported last few versions)
* Uses more precise include ignoring, and includes a couple of typing requirements
    * Exposes a variable type change, fixed
* Adds a few extra (easy) strictness and config flags. Didn't add unreachable, since it was more involved.

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
  • Loading branch information
henryiii and pradyunsg committed May 12, 2022
1 parent 53dbb25 commit 6da5d33
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Expand Up @@ -8,11 +8,12 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v0.950
hooks:
- id: mypy
exclude: '^(docs|tasks|tests)|setup\.py'
args: []
additional_dependencies: [pyparsing, nox]

- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Expand Up @@ -4,7 +4,6 @@ include LICENSE LICENSE.APACHE LICENSE.BSD
include .coveragerc
include .flake8
include .pre-commit-config.yaml
include mypy.ini

recursive-include docs *
recursive-include tests *.py
Expand Down
17 changes: 0 additions & 17 deletions mypy.ini

This file was deleted.

4 changes: 2 additions & 2 deletions packaging/requirements.py
Expand Up @@ -20,7 +20,7 @@
stringStart,
)

from .markers import MARKER_EXPR, Marker
from .markers import MARKER_EXPR as _MARKER_EXPR, Marker
from .specifiers import LegacySpecifier, Specifier, SpecifierSet


Expand Down Expand Up @@ -66,7 +66,7 @@ class InvalidRequirement(ValueError):
VERSION_SPEC = originalTextFor(_VERSION_SPEC)("specifier")
VERSION_SPEC.setParseAction(lambda s, l, t: t[1])

MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
MARKER_EXPR = originalTextFor(_MARKER_EXPR())("marker")
MARKER_EXPR.setParseAction(
lambda s, l, t: Marker(s[t._original_start : t._original_end])
)
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
@@ -1,3 +1,13 @@
[build-system]
requires = ['setuptools >= 40.8.0', 'wheel']
build-backend = 'setuptools.build_meta'


[tool.mypy]
strict = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]

[[tool.mypy.overrides]]
module = ["_manylinux"]
ignore_missing_imports = true

0 comments on commit 6da5d33

Please sign in to comment.