forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
134 lines (119 loc) · 4.1 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[build-system]
requires = [
# NOTE: this needs to be kept in sync with mypy-requirements.txt
# and build-requirements.txt, because those are both needed for
# self-typechecking :/
"setuptools >= 75.1.0",
# the following is from mypy-requirements.txt/setup.py
"typing_extensions>=4.6.0",
"mypy_extensions>=1.0.0",
"tomli>=1.1.0; python_version<'3.11'",
# the following is from build-requirements.txt
"types-psutil",
"types-setuptools",
]
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 99
target-version = ["py38", "py39", "py310", "py311", "py312"]
skip-magic-trailing-comma = true
force-exclude = '''
^/mypy/typeshed|
^/mypyc/test-data|
^/test-data
'''
[tool.ruff]
line-length = 99
target-version = "py38"
fix = true
extend-exclude = [
"@*",
# Sphinx configuration is irrelevant
"docs/source/conf.py",
"mypyc/doc/conf.py",
# tests have more relaxed styling requirements
# fixtures have their own .pyi-specific configuration
"test-data/*",
"mypyc/test-data/*",
# typeshed has its own .pyi-specific configuration
"mypy/typeshed/*",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle (error)
"F", # pyflakes
"W", # pycodestyle (warning)
"B", # flake8-bugbear
"I", # isort
"RUF100", # Unused noqa comments
"PGH004", # blanket noqa comments
"UP", # pyupgrade
"C4", # flake8-comprehensions
"SIM201", "SIM202", # simplify comparisons involving not
"ISC001", # implicitly concatenated string
"RET501", "RET502", # better return None handling
]
ignore = [
"B007", # Loop control variable not used within the loop body.
"B011", # Don't use assert False
"B023", # Function definition does not bind loop variable
"E2", # conflicts with black
"E402", # module level import not at top of file
"E501", # conflicts with black
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # Ambiguous variable name
"UP031", # Use format specifiers instead of percent format
"UP032", # 'f-string always preferable to format' is controversial
"C416", # There are a few cases where it's nice to have names for the dict items
]
unfixable = [
"F841", # unused variable. ruff keeps the call, but mostly we want to get rid of it all
"F601", # automatic fix might obscure issue
"F602", # automatic fix might obscure issue
"B018", # automatic fix might obscure issue
"UP036", # sometimes it's better to just noqa this
]
[tool.ruff.lint.isort]
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
[tool.check-manifest]
ignore = ["**/.readthedocs.yaml"]
[tool.pytest.ini_options]
minversion = "7.0.0"
testpaths = ["mypy/test", "mypyc/test"]
python_files = 'test*.py'
# Where do the test cases come from? We provide our own collection
# logic by implementing `pytest_pycollect_makeitem` in mypy.test.data;
# the test files import that module, and pytest sees the magic name
# and invokes it at the relevant moment. See
# https://doc.pytest.org/en/latest/how-to/writing_plugins.html#collection-hooks
# Both our plugin and unittest provide their own collection logic,
# So we can disable the default python collector by giving it empty
# patterns to search for.
# Note that unittest requires that no "Test*" classes exist.
python_classes = []
python_functions = []
# always run in parallel (requires pytest-xdist, see test-requirements.txt)
# and enable strict mode: require all markers
# to be defined and raise on invalid config values
addopts = "-nauto --strict-markers --strict-config"
# treat xpasses as test failures so they get converted to regular tests as soon as possible
xfail_strict = true
[tool.coverage.run]
branch = true
source = ["mypy"]
parallel = true
[tool.coverage.report]
show_missing = true
skip_covered = true
omit = ['mypy/test/*']
exclude_lines = [
'\#\s*pragma: no cover',
'^\s*raise AssertionError\b',
'^\s*raise NotImplementedError\b',
'^\s*return NotImplemented\b',
'^\s*raise$',
'^assert False\b',
'''^if __name__ == ['"]__main__['"]:$''',
]