From d04a7e2f491215287dddee039393c5b173829220 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 18 Jan 2025 18:55:12 +0000 Subject: [PATCH] uv: use for CI and releasing main package --- .ci/run | 16 ++++++---------- .github/workflows/main.yml | 6 +++--- tox.ini | 4 +--- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.ci/run b/.ci/run index b2c184d..c881818 100755 --- a/.ci/run +++ b/.ci/run @@ -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 case "$OSTYPE" in @@ -20,7 +22,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? @@ -29,12 +32,5 @@ if [ -n "${CI-}" ]; then esac fi - -PY_BIN="python3" -# some systems might have python pointing to python3 -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 "$@" +# NOTE: expects uv installed +uv tool run --with tox-uv tox $tox_cmd "$@" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76a8b4a..d95683c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + + - uses: astral-sh/setup-uv@v5 - uses: actions/checkout@v4 with: @@ -87,6 +89,4 @@ jobs: # always deploy tags to release pypi # NOTE: release tags are guarded by on: push: tags on the top if: github.event_name != 'pull_request' && startsWith(github.event.ref, 'refs/tags') - env: - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - run: pip3 install --user --upgrade build twine && .ci/release + run: .ci/release-uv diff --git a/tox.ini b/tox.ini index f113f6d..48beed9 100644 --- a/tox.ini +++ b/tox.ini @@ -18,9 +18,7 @@ passenv = MYPY_CACHE_DIR RUFF_CACHE_DIR 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} +uv_seed = true # seems necessary so uv creates separate venvs per tox env? [testenv:ruff]