Skip to content

Commit

Permalink
🔒 Lock down PEP 517 / PEP 660 build deps
Browse files Browse the repository at this point in the history
Tox v4.14.1 regression ref: tox-dev/tox#3238
  • Loading branch information
webknjaz committed Aug 20, 2024
1 parent 3d0f77d commit 1d4bf70
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
1 change: 1 addition & 0 deletions requirements/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.txt
16 changes: 16 additions & 0 deletions requirements/dist-build-constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# tox r -e pip-compile-build-lock --
#
packaging==24.1
# via setuptools-scm
setuptools-scm==8.1.0
# via awx-plugins-core (pyproject.toml::build-system.requires)

# The following packages are considered to be unsafe in a requirements file:
setuptools==73.0.0
# via
# awx-plugins-core (pyproject.toml::build-system.requires)
# setuptools-scm
2 changes: 1 addition & 1 deletion requirements/tox-pip-compile.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pip-tools >= 6.14.0 # first to support config file
pip-tools >= 7.4.0 # first to support build env dep extraction
49 changes: 43 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ set_env =
wheel_build_env = .pkg


[pkgenv]
# NOTE: `[testenv:.pkg]` does not work due to a regression in tox v4.14.1
# NOTE: so `[pkgenv]` is being used in place of it.
# Refs:
# * https://github.com/tox-dev/tox/pull/3237
# * https://github.com/tox-dev/tox/issues/3238
# * https://github.com/tox-dev/tox/issues/3292
# * https://hynek.me/articles/turbo-charge-tox/
set_env =
PIP_CONSTRAINT = requirements{/}dist-build-constraints.txt


[testenv:cleanup-dists]
description =
Wipe the the dist{/} folder
Expand All @@ -96,19 +108,22 @@ package = skip


[testenv:build-dists]
allowlist_externals =
env
description =
Build dists with {basepython} and put them into the dist{/} folder
depends =
cleanup-dists
deps =
build ~= 1.2.1
commands =
{envpython} \
{[python-cli-options]byte-errors} \
{[python-cli-options]max-isolation} \
{[python-cli-options]warnings-to-errors} \
-m build \
{posargs:}
env PIP_CONSTRAINT=requirements{/}dist-build-constraints.txt \
{envpython} \
{[python-cli-options]byte-errors} \
{[python-cli-options]max-isolation} \
{[python-cli-options]warnings-to-errors} \
-m build \
{posargs:}
commands_post =
package = skip

Expand Down Expand Up @@ -469,3 +484,25 @@ commands_post =
package = skip
set_env =
CUSTOM_COMPILE_COMMAND = tox r -e {envname} -- {posargs:}


[testenv:pip-compile-build-lock]
description = Produce a PEP 517/660 build deps lock using {envpython}
deps = {[testenv:pip-compile]deps}
commands =
{envpython} \
{[python-cli-options]byte-warnings} \
{[python-cli-options]max-isolation} \
{[python-cli-options]warnings-to-errors} \
'-Wdefault{:}pkg_resources is deprecated as an API{:}DeprecationWarning' \
'-Wdefault{:}Unimplemented abstract methods{:}DeprecationWarning' \
-m piptools \
compile \
--only-build-deps \
--all-build-deps \
--output-file=requirements{/}dist-build-constraints.txt \
{posargs:}
commands_post =
set_env =
CUSTOM_COMPILE_COMMAND = tox r -e {envname} -- {posargs:}
package = {[testenv:pip-compile]package}

0 comments on commit 1d4bf70

Please sign in to comment.