-
-
Notifications
You must be signed in to change notification settings - Fork 310
Expand file tree
/
Copy pathpyproject.toml
More file actions
459 lines (387 loc) · 14.5 KB
/
pyproject.toml
File metadata and controls
459 lines (387 loc) · 14.5 KB
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
[build-system]
# N.B.: We use `setup.cfg` for declarative metadata instead of `[project]` here since support for
# pyproject.toml projects was introduced in setuptools 61.0.0 which only supports Python>=3.7. We
# need to also support 2.7, 3.5 and 3.6.
requires = ["setuptools", "uv"]
backend-path = ["build-backend", ""]
build-backend = "pex_build.setuptools.build"
[tool.pex.build_backend]
delegate-build-backend = "setuptools.build_meta"
plugins = ["pex_build"]
[[tool.pex.build_backend.script-locks]]
command = [
"uv",
"export",
"--frozen",
"--format",
"pylock.toml",
"--no-header",
"--no-emit-project",
"--all-extras",
"--no-dev",
"-q",
"-o",
"{lock_path}",
]
[tool.pex_build.setuptools.build.project]
# N.B.: When the `when` criteria is met, the remaining fields are copied to the [project] table
# during metadata generation. Since our `package` command runs under the `when` criteria, this
# ensures modern project metadata is used to create our distributions even when it conflicts with
# older version of Python / setuptools.
when = "python_version >= '3.9'"
license = "Apache-2.0"
license-files = ["LICENSE"]
[project]
name = "pex"
# N.B.: This must be kept in sync with the same setting in setup.cfg to support Python 2.7.
requires-python = ">=2.7,<3.16,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*"
dynamic = [
"authors",
"classifiers",
"description",
"entry-points",
"keywords",
"optional-dependencies",
"readme",
"scripts",
"urls",
"version",
]
[dependency-groups]
dev = [
# This is the core dep needed to run all other commands.
{include-group = "dev-cmd"},
{include-group = "build-cache-image"},
{include-group = "devpi-server"},
{include-group = "docs"},
{include-group = "fmt"},
{include-group = "gen-scie-platform"},
{include-group = "lint"},
{include-group = "mypy"},
{include-group = "package"},
{include-group = "test"},
{include-group = "vendor"},
]
build-cache-image = [
{include-group = "dev-cmd"},
"ansicolors",
"coloredlogs; python_version >= '3.8'",
"PyYAML; python_version >= '3.8'",
]
dev-cmd = ["dev-cmd[old-pythons]; python_version >= '3.8'"]
devpi-server = ["devpi-server; python_version >= '3.8'"]
docs = [
{include-group = "dev-cmd"},
"furo; python_version >= '3.8'",
"httpx; python_version >= '3.8'",
"myst-parser[linkify]; python_version >= '3.8'",
# The 0.11.0 release removes deprecated API parameters which breaks weasyprint (62.3 depends on
# `pydyf>=0.10.0`) which is a dependency of sphinx-simplepdf.
"pydyf<0.11.0; python_version >= '3.8'",
"sphinx; python_version >= '3.8'",
"sphinx-simplepdf; python_version >= '3.8'",
]
fmt = [
{include-group = "dev-cmd"},
"black==21.12b0; python_full_version >= '3.6.2'",
"click==8.0.1; python_version >= '3.6'", # The 8.1.0 release of click breaks black; so we pin.
"isort==5.10.1; python_full_version >= '3.6.1'",
]
gen-scie-platform = [
{include-group = "dev-cmd"},
"PyGithub; python_version >= '3.8'",
# Pinned, so we get pre-built wheels from piwheels.
"cffi==1.17.1; python_version >= '3.8'",
"cryptography==42.0.8; python_version >= '3.8'",
"pynacl==1.5.0; python_version >= '3.8'",
"httpx; python_version >= '3.8'",
]
lint = [
{include-group = "dev-cmd"},
# The last version to support pyflakes 2.4.0 (see below).
"autoflake==1.7.8; python_version >= '3.8'",
# The last version to support Python 2.7 comment type hints.
"pyflakes==2.4.0; python_version >= '3.8'",
]
mypy = [
{include-group = "dev-cmd"},
# These versions should track the version in pex/vendor/__init__.py.
"ansicolors==1.1.8",
"appdirs==1.4.4",
"attrs @ git+https://github.com/python-attrs/attrs@947bfb542104209a587280701d8cb389c813459d",
# This is just used as a constraint - the dep is via:
# spinx 5.1.1 -> jinja2>=2.3 -> MarkupSafe>=2.0
# This works around a mypy bug handling positional-only arguments for `--python-version` >=3.8
# that was not fixed until 0.981 (we're stuck on 0.971). MarkupSafe>=3 uses positional argument
# only notation.
"MarkupSafe<3",
# We pin at 0.971 since this is the last version of mypy that supports `--python-version 2.7`.
"mypy[python2]==0.971; python_version >= '3.8' and python_version < '3.12'",
# These versions should track the version in pex/vendor/__init__.py.
"packaging==20.9; python_version < '3.12'", # This version should track the lowest version in pex/vendor/__init__.py.
"packaging>=21; python_version >= '3.12'",
"toml==0.10.2", # This versions should track the version in pex/vendor/__init__.py.
# The following stubs are pinned at the last version that does not use positional-only parameter
# syntax (/) not available to `--python-version 2.7` type checks.
"types-PyYAML==6.0.12.12; python_version >= '3.8'",
"types-appdirs==1.4.3.5; python_version >= '3.8'",
"types-docutils==0.20.0.20240310; python_version >= '3.8'",
"types-mock==5.1.0.20240106; python_version >= '3.8'",
"types-pexpect==4.9.0.20240207; python_version >= '3.8'",
"types-python-dateutil==2.9.0.20241206; python_version >= '3.8'",
"types-setuptools==69.1.0.20240302; python_version >= '3.8'",
# 0.10.6 stubs are not compatible with Python 2.7
"types-toml==0.10.5; python_version >= '3.8'",
{include-group = "build-cache-image"},
{include-group = "devpi-server"},
{include-group = "docs"},
{include-group = "fmt"},
{include-group = "gen-scie-platform"},
{include-group = "package"},
{include-group = "test"},
{include-group = "vendor"},
]
package = ["build"]
test = [
{include-group = "dev-cmd"},
"ansicolors",
"coloredlogs",
"mock; python_version == '2.7'",
# The more-itertools project is an indirect requirement of pytest, and it's broken for
# Python < 3.6 in newer releases so we force low here.
"more-itertools<=8.10.0; python_version < '3.6'",
"pexpect",
"psutil",
"pytest",
"pytest-md-report; python_version >= '3.9'",
"pytest-retry; python_version >= '3.9'",
"pytest-xdist",
"python-dateutil",
"subprocess32",
{include-group = "devpi-server"},
]
vendor = [
{include-group = "dev-cmd"},
"ansicolors",
"httpx; python_version >= '3.8'",
"libcst; python_version >= '3.8'",
"pip==24.0; python_version >= '3.8'",
"setuptools==50.3.2; python_version >= '3.8'",
"wheel==0.35.1; python_version >= '3.8'",
]
[tool.uv]
cache-keys = [
{ file = "pex/docs/html/index.html" },
{ file = "pex/windows/stubs/*.exe" },
]
# This is used to force past a <2 upper bound in blacks deps, and it turns out black works just fine
# with this version of tomli.
override-dependencies = ["tomli==2.2.1; python_version >= '3.8'"]
[tool.black]
line-length = 100
target-version = ["py27"]
exclude = '''
/pex/(
vendor/_vendored/
|venv/virtualenv_16\.7\.12_py
)
'''
[tool.isort]
profile = "black"
line_length = 100
# The default skip list includes venv which causes pex/venv/** to be skipped; so we blank out the
# defaults here.
skip = []
skip_glob = [
"pex/vendor/_vendored/**",
"pex/venv/virtualenv_16.7.12_py"
]
[tool.dev-cmd.commands.build-cache-image]
description = "Build the CI cache data image."
when = "python_version >= '3.9'"
args = ["scripts/build-cache-image.py"]
accepts-extra-args = true
dependency-group = "build-cache-image"
hidden = true
[tool.dev-cmd.commands.check-git-clean]
args = ["git", "diff", "--exit-code"]
hidden = true
[tool.dev-cmd.commands.docs]
description = "Generate the Pex documentation static site and optionally serve it up."
when = "python_version >= '3.9'"
args = ["scripts/build-docs.py"]
dependency-group = "docs"
accepts-extra-args = true
[tool.dev-cmd.commands.embed-virtualenv]
when = "python_version >= '3.9'"
env = {PYTHONPATH = "."}
args = ["scripts/embed-virtualenv.py"]
hidden = true
[tool.dev-cmd.commands.enum-check]
python = "python2.7"
args = ["scripts/py27/lint_enum.py"]
accepts-extra-args = true
hidden = true
[tool.dev-cmd.commands.format]
description = "Auto-format the source code."
# N.B.: Our old version of black does not run under 3.14; so we pin to 3.11 for now to cover all
# cases.
python = "python3.11"
args = ["scripts/format.py"]
[tool.dev-cmd.commands.format-check]
# N.B.: Our old version of black does not run under 3.14; so we pin to 3.11 for now to cover all
# cases.
python = "python3.11"
args = ["scripts/format.py", "--check"]
hidden = true
[tool.dev-cmd.commands.gen-scie-platform]
when = "python_version >= '3.9'"
args = ["scripts/gen-scie-platform.py"]
accepts-extra-args = true
dependency-group = "gen-scie-platform"
hidden = true
[tool.dev-cmd.commands.gen-scie-platform.env]
PYTHONPATH = "."
# Used to get wheels for armv7l and riscv64.
PIP_EXTRA_INDEX_URL = """\
https://www.piwheels.org/simple \
https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple \
"""
[tool.dev-cmd.commands.lint]
# N.B.: Our old version of autoflake does not run correctly under 3.14 (fails to remove unused
# imports); so we pin to 3.11 for now to cover all cases.
python = "python3.11"
description = "Currently removes unused imports and code."
when = "python_version >= '3.9'"
args = ["scripts/lint.py"]
[tool.dev-cmd.commands.lint-check]
# N.B.: Our old version of autoflake does not run correctly under 3.14 (fails to remove unused
# imports); so we pin to 3.11 for now to cover all cases.
python = "python3.11"
when = "python_version >= '3.9'"
args = ["scripts/lint.py", "--check"]
hidden = true
[tool.dev-cmd.commands.package]
description = "Package the Pex PEX, sdist, wheel and PEX scies."
when = "python_version >= '3.9'"
env = {PYTHONPATH = "."}
args = ["scripts/create-packages.py"]
accepts-extra-args = true
[tool.dev-cmd.commands.requires-python-check]
args = ["scripts/requires-python-check.py"]
hidden = true
# TODO(John Sirois): Get dev-cmd to support attaching factors to the `command.name` to avoid all
# the copy-pasta here for our 3 branches.
[tool.dev-cmd.commands.test-lt39.factors]
py = "The Python version to run the tests under."
pip = "The Pip version to default to in test runs."
integration = "Run the integration tests (also available via `--it` pass through arg)."
[tool.dev-cmd.commands.test-lt39]
description = """
Run tests using pytest.
For example:
+ test: Run unit tests under the ambient Python interpreter.
+ test-py37: Run unit tests under Python 3.7 (A Python 3.7 must be somewhere on the `PATH`).
+ test-integration: Run integration tests under the ambient Python interpreter
+ test-py37-integration-pip22.3.1: Run integration tests under Python 3.7 using Pip 22.3.1.
The factors mix and match and are useful for parallel run of many setups; e.g.:
$ dev-cmd --parallel test-py3{9..13} -- -k test_compiler
"""
when = "python_version < '3.9'"
python = "{-py:}"
name = "test"
env = {PYTHONHASHSEED = "{--hashseed}", PYTHONUNBUFFERED = "1", _PEX_PIP_VERSION = "{-pip:}"}
args = ["testing/bin/run_tests.py", {discard_empty = "{-integration?--it:}"}]
accepts-extra-args = true
dependency-group = "test"
[tool.dev-cmd.commands.test-gte39-lt316.factors]
py = "The Python version to run the tests under."
pip = "The Pip version to default to in test runs."
integration = "Run the integration tests (also available via `--it` pass through arg)."
[tool.dev-cmd.commands.test-gte39-lt316]
description = """
Run tests using pytest.
For example:
+ test: Run unit tests under the ambient Python interpreter.
+ test-py37: Run unit tests under Python 3.7 (A Python 3.7 must be somewhere on the `PATH`).
+ test-integration: Run integration tests under the ambient Python interpreter
+ test-py37-integration-pip22.3.1: Run integration tests under Python 3.7 using Pip 22.3.1.
The factors mix and match and are useful for parallel run of many setups; e.g.:
$ dev-cmd --parallel test-py3{9..13} -- -k test_compiler
"""
when = "python_version >= '3.9' and python_version < '3.16'"
python = "{-py:}"
name = "test"
env = {PYTHONHASHSEED = "{--hashseed}", _PEX_PIP_VERSION = "{-pip:}"}
args = ["testing/bin/run_tests.py", {discard_empty = "{-integration?--it:}"}]
accepts-extra-args = true
dependency-group = "test"
[tool.dev-cmd.commands.typecheck]
description = "Type check the source code with MyPy."
python = "python3.11"
args = ["scripts/typecheck.py"]
[tool.dev-cmd.commands.vendorize]
python = "python3.9"
args = ["python", "-m", "pex.vendor"]
accepts-extra-args = true
dependency-group = "vendor"
hidden = true
[tool.dev-cmd.commands.vendorize-check]
python = "python3.9"
args = ["python", "-m", "pex.vendor", "--no-update"]
dependency-group = "vendor"
hidden = true
[tool.dev-cmd.tasks.checks]
description = """
Run the standard suite of Pex checks, including unit tests.
To just run the non-test checks, use `-stest` to skip tests.
"""
steps = ["format", "lint", "enum-check", "requires-python-check", "typecheck", "test"]
[tool.dev-cmd.tasks.vendor]
description = "Re-vendor Pex vendored dependencies."
steps = ["vendorize", "format"]
[tool.dev-cmd.tasks.vendor-check]
steps = ["embed-virtualenv", "vendorize-check", "check-git-clean"]
hidden = true
[tool.dev-cmd]
default = "checks"
exit-style = "immediate"
[[tool.dev-cmd.python]]
when = "python_version >= '3.7' and python_version < '3.16' and platform_machine != 'armv7l' and platform_machine != 'riscv64'"
# Suppress pyproject cache keys since uv.lock is enough to uniquely determine venv content.
pyproject-cache-keys = []
extra-cache-keys = ["uv.lock"]
3rdparty-export-command = [
"uv", "export", "-q",
"--frozen",
"--no-emit-project",
# Both uv and Pip can't handle VCS URLs in hashed requirements; so we handle this ourselves.
"--no-emit-package", "attrs",
"--only-group", "{dependency-group:dev}",
"-o", "{requirements.txt}"
]
3rdparty-pip-install-opts = ["--no-deps"]
extra-requirements = [
"-e", ".",
"attrs @ git+https://github.com/python-attrs/attrs@947bfb542104209a587280701d8cb389c813459d",
]
[[tool.dev-cmd.python]]
when = "python_version < '3.7' and platform_machine != 'armv7l' and platform_machine != 'riscv64'"
extra-requirements = [
"attrs @ git+https://github.com/python-attrs/attrs@947bfb542104209a587280701d8cb389c813459d",
]
# Editable installations need some help for Python 2.7, 3.5 & 3.6 in a modern world.
finalize-command = ["{venv-python}", "scripts/dev-cmd-fix-egg-link.py", "{venv-site-packages}"]
[[tool.dev-cmd.python]]
when = "platform_machine == 'armv7l' or platform_machine == 'riscv64'"
3rdparty-export-command = [
"uv", "export", "-q",
"--frozen",
"--no-emit-project",
# We get some wheels from https://www.piwheels.org/simple and
# https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
# but uv does not have hashes for those; so we just accept the pins.
"--no-hashes",
"--only-group", "{dependency-group:dev}",
"-o", "{requirements.txt}"
]