Skip to content

Commit e693bb0

Browse files
committed
test(mypy): move mypy config from setup.cfg to pyproject.toml
1 parent 9093446 commit e693bb0

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ repos:
1919
rev: v0.991
2020
hooks:
2121
- id: mypy
22-
additional_dependencies: [marshmallow-enum,typeguard,marshmallow]
22+
additional_dependencies:
23+
- marshmallow
24+
- marshmallow-enum
25+
- typeguard
26+
- types-setuptools
2327
args: [--show-error-codes]
2428
- repo: https://github.com/asottile/blacken-docs
2529
rev: v1.12.1

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,31 @@ target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py310']
66
filterwarnings = [
77
"error:::marshmallow_dataclass|test",
88
]
9+
10+
[tool.mypy]
11+
packages = [
12+
"marshmallow_dataclass",
13+
"tests",
14+
]
15+
# XXX: Can not load our plugin when running mypy from pre-commit.
16+
# Pre-commit runs mypy from its own venv (into which we do not want
17+
# to install marshmallow_dataclass).
18+
# The fact that our plugin is in a file named "mypy.py" causes issues
19+
# (I think) if we try to load it by path. In that case mypy adds
20+
# the containing directory to sys.path then calls import_module("mypy"),
21+
# which, in turn, finds the already imported sys.modules['mypy'].
22+
#
23+
# plugins = "marshmallow_dataclass.mypy"
24+
25+
warn_redundant_casts = true
26+
warn_unused_configs = true
27+
disable_error_code = "annotation-unchecked"
28+
29+
[[tool.mypy.overrides]]
30+
# dependencies without type hints
31+
module = [
32+
"marshmallow_enum",
33+
"typing_inspect",
34+
]
35+
ignore_missing_imports = true
36+

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ ignore = E203, E266, E501, W503
33
max-line-length = 100
44
max-complexity = 18
55
select = B,C,E,F,W,T4,B9
6-
7-
[mypy]
8-
ignore_missing_imports = true

0 commit comments

Comments
 (0)