-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
pyproject.toml
218 lines (195 loc) · 6.66 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
[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"
[project]
name = "mypy"
description = "Optional static typing for Python"
readme = {text = """
Mypy -- Optional Static Typing for Python
=========================================
Add type annotations to your Python programs, and use mypy to type
check them. Mypy is essentially a Python linter on steroids, and it
can catch many programming errors by analyzing your program, without
actually having to run it. Mypy has a powerful type system with
features such as type inference, gradual typing, generics and union
types.
""", content-type = "text/x-rst"}
authors = [{name = "Jukka Lehtosalo", email = "[email protected]"}]
license = {text = "MIT"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development",
"Typing :: Typed",
]
requires-python = ">=3.8"
dependencies = [
# When changing this, also update build-system.requires and mypy-requirements.txt
"typing_extensions>=4.6.0",
"mypy_extensions>=1.0.0",
"tomli>=1.1.0; python_version<'3.11'",
]
dynamic = ["version"]
[project.optional-dependencies]
dmypy = ["psutil>=4.0"]
mypyc = ["setuptools>=50"]
python2 = []
reports = ["lxml"]
install-types = ["pip"]
faster-cache = ["orjson"]
[project.urls]
Homepage = "https://www.mypy-lang.org/"
Documentation = "https://mypy.readthedocs.io/en/stable/index.html"
Repository = "https://github.com/python/mypy"
Changelog = "https://github.com/python/mypy/blob/master/CHANGELOG.md"
Issues = "https://github.com/python/mypy/issues"
[project.scripts]
mypy = "mypy.__main__:console_entry"
stubgen = "mypy.stubgen:main"
stubtest = "mypy.stubtest:main"
dmypy = "mypy.dmypy.client:console_entry"
mypyc = "mypyc.__main__:main"
[tool.setuptools.packages.find]
include = ["mypy*", "mypyc*", "*__mypyc*"]
namespaces = false
[tool.setuptools.package-data]
mypy = [
"py.typed",
"typeshed/**/*.py",
"typeshed/**/*.pyi",
"typeshed/stdlib/VERSIONS",
"xml/*.xsd",
"xml/*.xslt",
"xml/*.css",
]
[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
"N", # pep8-naming
"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
"N818", # Exception should be named with an Error suffix
"N806", # UPPER_CASE used for constant local variables
"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.per-file-ignores]
# Mixed case variable and function names.
"mypy/fastparse.py" = ["N802", "N816"]
[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__['"]:$''',
]