Skip to content

Commit

Permalink
tox: use uv for faster build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Oct 21, 2024
1 parent 6d53a25 commit be370fc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .ci/end2end/scripts/build_and_run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ cp -R -T /promnesia_source /promnesia
extension/.ci/build

git init # todo ??? otherwise setuptools-scm fails to detect the version...
python3 -m tox -e end2end -- "$@"

pip install uv
python3 -m uv tool run --with=tox-uv tox -e end2end -- "$@"
13 changes: 10 additions & 3 deletions .ci/run
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if ! command -v sudo; then
}
fi

# --parallel-live to show outputs while it's running
tox_cmd='run-parallel --parallel-live'
if [ -n "${CI-}" ]; then
# install OS specific stuff here
# TODO: pyjq is not necessary anymore? will keep CI deps just in case I guess
Expand All @@ -25,7 +27,8 @@ if [ -n "${CI-}" ]; then
;;
cygwin* | msys* | win*)
# windows
:
# ugh. parallel stuff seems super flaky under windows, some random failures, "file used by other process" and crap like that
tox_cmd='run'
;;
*)
# must be linux?
Expand All @@ -44,5 +47,9 @@ if ! command -v python3 &> /dev/null; then
PY_BIN="python"
fi

"$PY_BIN" -m pip install --user tox
"$PY_BIN" -m tox --parallel --parallel-live "$@"

# TODO hmm for some reason installing uv with pip and then running
# "$PY_BIN" -m uv tool fails with missing setuptools error??
# just uvx directly works, but it's not present in PATH...
"$PY_BIN" -m pip install --user pipx
"$PY_BIN" -m pipx run uv tool run --with=tox-uv tox $tox_cmd "$@"
10 changes: 6 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ passenv =
# but we want them on CI, so we allow to pass through the variable when we do want to run them
WITH_BROWSER_TESTS
# todo ugh this is all so confusing... need to simplify
usedevelop = true # for some reason tox seems to ignore "-e ." in deps section??
# note: --use-pep517 here is necessary for tox --parallel flag to work properly
# otherwise it seems that it tries to modify .eggs dir in parallel and it fails
install_command = {envpython} -m pip install --use-pep517 {opts} {packages}
setenv =
HPI_MODULE_INSTALL_USE_UV=true
uv_seed = true # seems necessary so uv creates separate venvs per tox env?


[testenv:ruff]
Expand All @@ -54,6 +53,7 @@ commands =
[testenv:tests-all]
deps =
-e .[testing,all,HPI,org]
uv # for hpi module install
commands =
# used in some tests
{envpython} -m my.core module install \
Expand All @@ -70,6 +70,7 @@ setenv =
PYTEST_TIMEOUT=120
deps =
-e .[testing,HPI]
uv # for hpi module install
commands =
{envpython} -m my.core module install my.hypothesis
{envpython} -m pytest \
Expand All @@ -83,6 +84,7 @@ commands =
[testenv:mypy-core]
deps =
-e .[testing]
uv # for hpi module install
commands =
{envpython} -m mypy --install-types --non-interactive \
# note: sources are tested separately, below
Expand Down

0 comments on commit be370fc

Please sign in to comment.