Skip to content

Commit b31d81c

Browse files
committed
Merge branch 'reproducibility/pip-tools-pep517-build-constraints' into devel
This patch attempts to integrate a forgotten constraints file into the tox setup. The idea is to make PEP 517 builds reproducible. The python-build tool (PEP 517 front-end) parses the build requirements from `pyproject.toml` and `pip install`s them into an ephemeral temporary virtualenv. Unfortunately, this tool does not expose any interface to pin those requirements. But the underlying tool, pip, supports setting CLI options through env vars. So the `--constraint` option corresponds to `PIP_CONSTRAINT` env var which this change relies on. The constraints file can be regenerated as follows: $ python -c 'from pathlib import Path; from sys import argv; from tomli import loads; print("\n".join(loads(Path(argv[1]).read_text())["build-system"].get("requires", [])))' pyproject.toml | python3 -m piptools compile --allow-unsafe --generate-hashes --strip-extras --output-file requirements-build.txt - This change temporarily disables including hashes into the constraints file per pypa/pip#9243. It also sticks to generating the pins under the lowest-supported Python version which is Python 3.6 to address pypa/pip#11321.
2 parents 0c443f1 + 504c8aa commit b31d81c

File tree

3 files changed

+49
-48
lines changed

3 files changed

+49
-48
lines changed

requirements-build.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

requirements-build.txt

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,32 @@
11
#
2-
# This file is autogenerated by pip-compile
2+
# This file is autogenerated by pip-compile with python 3.9
33
# To update, run:
44
#
5-
# pip-compile --generate-hashes --output-file=requirements-build.txt requirements-build.in
5+
# pip-compile --allow-unsafe --output-file=requirements-build.txt --strip-extras -
66
#
7-
cython==0.29.30 \
8-
--hash=sha256:019d330ac580b2ca4a457c464ac0b8c35009d820ef5d09f328d6e31a10e1ce89 \
9-
--hash=sha256:0b83a342a071c4f14e7410568e0c0bd95e2f20c0b32944e3a721649a1357fda4 \
10-
--hash=sha256:0cd6c932e945af15ae4ddcf8fdc0532bda48784c92ed0a53cf4fae897067ccd1 \
11-
--hash=sha256:1e078943bbde703ca08d43e719480eb8b187d9023cbd91798619f5b5e18d0d71 \
12-
--hash=sha256:20778297c8bcba201ca122a2f792a9899d6e64c68a92363dd7eb24306d54d7ce \
13-
--hash=sha256:2235b62da8fe6fa8b99422c8e583f2fb95e143867d337b5c75e4b9a1a865f9e3 \
14-
--hash=sha256:28db751e2d8365b39664d9cb62dc1668688b8fcc5b954e9ca9d20e0b8e03d8b0 \
15-
--hash=sha256:3993aafd68a7311ef94e00e44a137f6a50a69af0575ebcc8a0a074ad4152a2b2 \
16-
--hash=sha256:3d0239c7a22a0f3fb1deec75cab0078eba4dd17868aa992a54a178851e0c8684 \
17-
--hash=sha256:5183356c756b56c2df12d96300d602e47ffb89943c5a0bded66faca5d3da7be0 \
18-
--hash=sha256:58d2b734250c1093bc69c1c3a6f5736493b9f8b34eb765f0a28a4a09468c0b00 \
19-
--hash=sha256:5a8a3709ad9343a1dc02b8ec9cf6bb284be248d2c64af85464d9c3525eec74a5 \
20-
--hash=sha256:5c7cfd908efc77306ddd41ef07f5a7a352c9205ced5c1e00a0e5ece4391707c4 \
21-
--hash=sha256:5f2dae7dd56860018d5fd5032a71f11fdc224020932b463d0511a1536f27df85 \
22-
--hash=sha256:60d370c33d56077d30e5f425026e58c2559e93b4784106f61581cf54071f6270 \
23-
--hash=sha256:6b389a94b42909ff56d3491fde7c44802053a103701a7d210dcdd449a5b4f7b4 \
24-
--hash=sha256:71fd1d910aced510c001936667fc7f2901c49b2ca7a2ad67358979c94a7f42ac \
25-
--hash=sha256:786ee7b0cdb508b6de64c0f1f9c74f207186dfafad1ef938f25b7494cc481a80 \
26-
--hash=sha256:7eff71c39b98078deaad1d1bdbf10864d234e2ab5d5257e980a6926a8523f697 \
27-
--hash=sha256:80a7255ad84620f53235c0720cdee2bc7431d9e3db7b3742823a606c329eb539 \
28-
--hash=sha256:88c5e2f92f16cd999ddfc43d572639679e8a057587088e627e98118e46a803e6 \
29-
--hash=sha256:8e08f18d249b9b65e272a5a60f3360a8922c4c149036b98fc821fe1afad5bdae \
30-
--hash=sha256:9462e9cf284d9b1d2c5b53d62188e3c09cc5c7a0018ba349d99b73cf930238de \
31-
--hash=sha256:9826981308802c61a76f967875b31b7c683b7fc369eabaa6cbc22efeb12c90e8 \
32-
--hash=sha256:9f1fe924c920b699af27aefebd722df4cfbb85206291623cd37d1a7ddfd57792 \
33-
--hash=sha256:a30092c6e2d24255fbfe0525f9a750554f96a263ed986d12ac3c9f7d9a85a424 \
34-
--hash=sha256:abcaf99f90cddc0f53600613eaafc81d27c4ac0671f0df8bce5466d4e86d54a1 \
35-
--hash=sha256:acb72e0b42079862cf2f894964b41f261e941e75677e902c5f4304b3eb00af33 \
36-
--hash=sha256:b17639b6a155abaa61a89f6f1323fb57b138d0529911ca03978d594945d062ba \
37-
--hash=sha256:c299c5b250ae9f81c38200441b6f1d023aeee9d8e7f61c04001c7437181ccb06 \
38-
--hash=sha256:c79685dd4631a188e2385dc6a232896c7b67ea2e3e5f8b5555b4b743f475d6d7 \
39-
--hash=sha256:d0859a958e0155b6ae4dee04170ccfac2c3d613a7e3bee8749614530b9e3b4a4 \
40-
--hash=sha256:d0f34b44078e3e0b2f1be2b99044619b37127128e7d55c54bbd2438adcaf31d3 \
41-
--hash=sha256:d166d9f853db436f5e10733a9bd615699ddb4238feadcbdf5ae50dc0b18b18f5 \
42-
--hash=sha256:d52d5733dcb144deca8985f0a197c19cf71e6bd6bd9d8034f3f67b2dea68d12b \
43-
--hash=sha256:e29d3487f357108b711f2f29319811d92166643d29aec1b8e063aad46a346775 \
44-
--hash=sha256:e36755e71fd20eceb410cc441b7f2586654c2edb013f4663842fdaf60b96c1ca \
45-
--hash=sha256:e5cb144728a335d7a7fd0a61dff6abb7a9aeff9acd46d50b886b7d9a95bb7311 \
46-
--hash=sha256:e605635a92ae862cb46d84d1d6883324518f9aaff4a71cede6d61df20b6a410c \
47-
--hash=sha256:ffa8c09617833ff0824aa7926fa4fa9d2ec3929c67168e89105f276b7f36a63e
7+
cython==0.29.30
8+
# via -r -
9+
expandvars==0.9.0
10+
# via -r -
11+
packaging==21.3
12+
# via setuptools-scm
13+
pyparsing==3.0.9
14+
# via packaging
15+
setuptools-scm==6.4.2
16+
# via -r -
17+
setuptools-scm-git-archive==1.4
18+
# via -r -
19+
toml==0.10.2
20+
# via -r -
21+
tomli==1.2.3
22+
# via setuptools-scm
23+
typing-extensions==4.3.0
24+
# via setuptools-scm
25+
wheel==0.37.1
26+
# via -r -
27+
28+
# The following packages are considered to be unsafe in a requirements file:
29+
setuptools==59.6.0
30+
# via
31+
# -r -
32+
# setuptools-scm

tox.ini

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ commands =
3232
[testenv]
3333
allowlist_externals =
3434
{env:CATCHSEGV_BINARY:}
35+
env
3536
sh
3637
isolated_build = true
3738
usedevelop = false
@@ -76,6 +77,8 @@ commands_pre =
7677
-f {env:PEP517_OUT_DIR} \
7778
--no-index \
7879
ansible-pylibssh
80+
install_command =
81+
{[dists]install_command}
7982
setenv =
8083
{[dists]setenv}
8184

@@ -106,13 +109,19 @@ commands_pre =
106109
-f {toxinidir}/.github/workflows/.tmp/deps \
107110
--no-index \
108111
ansible-pylibssh
112+
install_command =
113+
{[dists]install_command}
109114
setenv =
110115
{[dists]setenv}
111116

112117
[dists]
118+
install_command =
119+
env PIP_CONSTRAINT= \
120+
{envpython} -m pip install {opts} {packages}
113121
setenv =
114122
{[testenv]setenv}
115123
PEP517_OUT_DIR = {env:PEP517_OUT_DIR:{toxinidir}{/}dist}
124+
PIP_CONSTRAINT = {toxinidir}/requirements-build.txt
116125

117126

118127
[testenv:cleanup-dists]
@@ -123,6 +132,8 @@ description =
123132
usedevelop = false
124133
skip_install = true
125134
deps =
135+
install_command =
136+
{[dists]install_command}
126137
setenv =
127138
{[dists]setenv}
128139
commands =
@@ -140,6 +151,8 @@ usedevelop = false
140151
skip_install = true
141152
deps =
142153
build ~= 0.7.0
154+
install_command =
155+
{[dists]install_command}
143156
passenv =
144157
PEP517_BUILD_ARGS
145158
setenv =
@@ -165,10 +178,13 @@ deps =
165178
# NOTE: v20 added support for backend-path
166179
# NOTE: in pyproject.toml and we use it
167180
pip >= 20
181+
install_command =
182+
{[dists]install_command}
168183
setenv =
169184
{[dists]setenv}
170185
commands =
171-
{envpython} -m pip wheel \
186+
env PIP_CONSTRAINT= \
187+
{envpython} -m pip wheel \
172188
--no-deps \
173189
--wheel-dir "{env:PEP517_OUT_DIR}" \
174190
"{toxinidir}"
@@ -187,6 +203,8 @@ usedevelop = false
187203
skip_install = true
188204
deps =
189205
delocate
206+
install_command =
207+
{[dists]install_command}
190208
setenv =
191209
{[dists]setenv}
192210
commands =
@@ -216,6 +234,8 @@ depends =
216234
delocate-macos-wheels
217235
deps =
218236
twine
237+
install_command =
238+
{[dists]install_command}
219239
usedevelop = false
220240
skip_install = true
221241
setenv =

0 commit comments

Comments
 (0)