-
Notifications
You must be signed in to change notification settings - Fork 3k
/
pyproject.toml
316 lines (275 loc) · 8.67 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
[project]
dynamic = ["version"]
name = "pip"
description = "The PyPA recommended tool for installing Python packages."
readme = "README.rst"
license = {text = "MIT"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
authors = [
{name = "The pip developers", email = "[email protected]"},
]
# NOTE: requires-python is duplicated in __pip-runner__.py.
# When changing this value, please change the other copy as well.
requires-python = ">=3.8"
[project.scripts]
pip = "pip._internal.cli.main:main"
pip3 = "pip._internal.cli.main:main"
[project.urls]
Homepage = "https://pip.pypa.io/"
Documentation = "https://pip.pypa.io"
Source = "https://github.com/pypa/pip"
Changelog = "https://pip.pypa.io/en/stable/news/"
[build-system]
# The lower bound is for <https://github.com/pypa/setuptools/issues/3865>.
requires = ["setuptools>=67.6.1"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = false
[tool.setuptools.dynamic]
version = {attr = "pip.__version__"}
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["contrib", "docs", "tests*", "tasks"]
[tool.setuptools.package-data]
"pip" = ["py.typed"]
"pip._vendor" = ["vendor.txt"]
"pip._vendor.certifi" = ["*.pem"]
"pip._vendor.requests" = ["*.pem"]
"pip._vendor.distlib._backport" = ["sysconfig.cfg"]
"pip._vendor.distlib" = [
"t32.exe",
"t64.exe",
"t64-arm.exe",
"w32.exe",
"w64.exe",
"w64-arm.exe",
]
######################################################################################
# towncrier
#
[tool.towncrier]
# For finding the __version__
package = "pip"
package_dir = "src"
# For writing into the correct file
filename = "NEWS.rst"
# For finding the news fragments
directory = "news/"
# For rendering properly for this project
issue_format = "`#{issue} <https://github.com/pypa/pip/issues/{issue}>`_"
template = "tools/news/template.rst"
# Grouping of entries, within our changelog
type = [
{ name = "Deprecations and Removals", directory = "removal", showcontent = true },
{ name = "Features", directory = "feature", showcontent = true },
{ name = "Bug Fixes", directory = "bugfix", showcontent = true },
{ name = "Vendored Libraries", directory = "vendor", showcontent = true },
{ name = "Improved Documentation", directory = "doc", showcontent = true },
{ name = "Process", directory = "process", showcontent = true },
{ name = "Trivial Changes", directory = "trivial", showcontent = false },
]
######################################################################################
# vendoring
#
[tool.vendoring]
destination = "src/pip/_vendor/"
requirements = "src/pip/_vendor/vendor.txt"
namespace = "pip._vendor"
protected-files = ["__init__.py", "README.rst", "vendor.txt"]
patches-dir = "tools/vendoring/patches"
[tool.vendoring.transformations]
substitute = [
# pkg_resource's vendored packages are directly vendored in pip.
{ match='pkg_resources\.extern', replace="pip._vendor" },
{ match='from \.extern', replace="from pip._vendor" },
{ match='''\('pygments\.lexers\.''', replace="('pip._vendor.pygments.lexers." },
]
drop = [
# contains unnecessary scripts
"bin/",
# interpreter and OS specific msgpack libs
"msgpack/*.so",
# optional accelerator extension libraries
"*mypyc*.so",
"tomli/*.so",
# unneeded parts of setuptools
"easy_install.py",
"setuptools",
"pkg_resources/_vendor/",
"_distutils_hack",
"distutils-precedence.pth",
"pkg_resources/extern/",
# trim vendored pygments styles and lexers
"pygments/styles/[!_]*.py",
'^pygments/lexers/(?!python|__init__|_mapping).*\.py$',
# trim rich's markdown support
"rich/markdown.py",
]
[tool.vendoring.typing-stubs]
distro = []
[tool.vendoring.license.directories]
setuptools = "pkg_resources"
[tool.vendoring.license.fallback-urls]
distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt"
######################################################################################
# ruff
#
[tool.ruff]
src = ["src"]
line-length = 88
extend-exclude = [
"_vendor",
"./build",
".scratch",
"data",
]
[tool.ruff.lint]
ignore = [
"B019",
"B020",
"B904", # Ruff enables opinionated warnings by default
"B905", # Ruff enables opinionated warnings by default
]
select = [
"ASYNC",
"B",
"C4",
"C90",
"E",
"F",
"G",
"I",
"ISC",
"PERF",
"PLE",
"PLR0",
"W",
"RUF100",
"UP",
]
[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
"third-party",
"vendored",
"first-party",
"tests",
"local-folder",
]
[tool.ruff.lint.isort.sections]
"vendored" = ["pip._vendor"]
"tests" = ["tests"]
[tool.ruff.lint.mccabe]
max-complexity = 33 # default is 10
[tool.ruff.lint.per-file-ignores]
"noxfile.py" = ["G"]
"src/pip/_internal/*" = ["PERF203"]
"tests/*" = ["B011"]
"tests/unit/test_finder.py" = ["C414"]
"src/pip/__pip-runner__.py" = ["UP"] # Must be compatible with Python 2.7
[tool.ruff.lint.pylint]
max-args = 15 # default is 5
max-branches = 28 # default is 12
max-returns = 13 # default is 6
max-statements = 134 # default is 50
######################################################################################
# mypy
#
[tool.mypy]
mypy_path = "$MYPY_CONFIG_FILE_DIR/src"
strict = true
no_implicit_reexport = false
disallow_subclassing_any = false
disallow_untyped_calls = false
warn_return_any = false
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "pip._internal.utils._jaraco_text"
ignore_errors = true
[[tool.mypy.overrides]]
module = "pip._vendor.*"
ignore_errors = true
# These vendored libraries use runtime magic to populate things and don't sit
# well with static typing out of the box. Eventually we should provide correct
# typing information for their public interface and remove these configs.
[[tool.mypy.overrides]]
module = "pip._vendor.pkg_resources"
follow_imports = "skip"
[[tool.mypy.overrides]]
module = "pip._vendor.requests.*"
follow_imports = "skip"
######################################################################################
# pytest
#
[tool.pytest.ini_options]
addopts = "--ignore src/pip/_vendor --ignore tests/tests_cache -r aR --color=yes"
xfail_strict = true
markers = [
"network: tests that need network",
"incompatible_with_sysconfig",
"incompatible_with_venv",
"no_auto_tempdir_manager",
"unit: unit tests",
"integration: integration tests",
"bzr: VCS: Bazaar",
"svn: VCS: Subversion",
"mercurial: VCS: Mercurial",
"git: VCS: git",
"search: tests for 'pip search'",
]
######################################################################################
# coverage
#
[tool.coverage.run]
branch = true
# Do not gather coverage for vendored libraries.
omit = "*/_vendor/*"
# Centralized absolute file prefix for coverage files.
data_file = "${COVERAGE_OUTPUT_DIR}/.coverage"
# By default, each covered process will try to truncate and then write to
# `data_file`, but with `parallel`, they will write to separate files suffixed
# with hostname, pid, and a timestamp.
parallel = true
# If not set, then at the termination of each worker (when using pytest-xdist),
# the following is traced: "Coverage.py warning: Module pip was previously
# imported, but not measured (module-not-measured)"
disable_warnings = "module-not-measured"
[tool.coverage.paths]
# We intentionally use "source0" here because pytest-cov unconditionally sets
# "source" after loading the config.
source0 = [
# The primary source code path which other paths will be combined into.
"src/pip/",
# Unit test source directory e.g.
# `.tox/coverage-py3/lib/pythonX.Y/site-packages/pip/...`
"*/site-packages/pip/",
# Functional test virtual environment directories, which look like
# `tmpdir/pip0/pip/src/pip/...`
"*/pip/src/pip/",
]
[tool.coverage.report]
exclude_lines = [
# We must re-state the default because the `exclude_lines` option overrides
# it.
"pragma: no cover",
# This excludes typing-specific code, which will be validated by mypy anyway.
"if TYPE_CHECKING",
]