From d3b44d10ce00618f77478a00d7f903151bc64dc4 Mon Sep 17 00:00:00 2001 From: Daniel King <43149077+dakinggg@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:04:46 -0700 Subject: [PATCH] pip -> uv (#22) --- .github/actions/code-quality/action.yaml | 11 +++++++++-- .github/actions/coverage/action.yaml | 12 +++++++++--- .github/actions/pytest-cpu/action.yaml | 11 +++++++++-- .github/actions/pytest-gpu/action.yaml | 22 ++++++++-------------- .github/actions/smoketest/action.yaml | 13 ++++++++++--- .github/mcli/mcli_pytest.py | 6 +++++- 6 files changed, 50 insertions(+), 25 deletions(-) diff --git a/.github/actions/code-quality/action.yaml b/.github/actions/code-quality/action.yaml index f4d36ce..3220c63 100644 --- a/.github/actions/code-quality/action.yaml +++ b/.github/actions/code-quality/action.yaml @@ -13,12 +13,19 @@ runs: - uses: actions/setup-python@v4 with: python-version: ${{ inputs.python_version }} + - name: Activate virtualenv + shell: bash + run: | + python -m venv ../.venv + . ../.venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: Setup shell: bash run: | set -ex - python -m pip install --upgrade pip wheel - python -m pip install --upgrade .${{ inputs.pip_deps }} + pip install uv + uv pip install --upgrade --system pip wheel + uv pip install --upgrade --system .${{ inputs.pip_deps }} - name: Run checks shell: bash run: | diff --git a/.github/actions/coverage/action.yaml b/.github/actions/coverage/action.yaml index 38e76aa..82ac3cc 100644 --- a/.github/actions/coverage/action.yaml +++ b/.github/actions/coverage/action.yaml @@ -6,12 +6,19 @@ inputs: runs: using: composite steps: + - name: Activate virtualenv + shell: bash + run: | + python -m venv .venv + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: Setup shell: bash run: | set -ex - python -m pip install --upgrade pip wheel - pip install coverage[toml]==6.5.0 + pip install uv + uv pip install --upgrade pip wheel + uv pip install coverage[toml]==6.5.0 - name: Download artifacts uses: actions/download-artifact@v3 with: @@ -20,7 +27,6 @@ runs: shell: bash run: | set -ex - # Flatten the coverage files # yamllint disable-line rule:line-length ls ${{ inputs.download-path }} | while read x; do mv ${{ inputs.download-path }}/$x/.coverage .coverage.$x; done diff --git a/.github/actions/pytest-cpu/action.yaml b/.github/actions/pytest-cpu/action.yaml index 92842a1..27f08c7 100644 --- a/.github/actions/pytest-cpu/action.yaml +++ b/.github/actions/pytest-cpu/action.yaml @@ -65,14 +65,21 @@ runs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Activate virtualenv + shell: bash + run: | + python -m venv .venv + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: Setup shell: bash run: | set -ex export PATH=/composer-python:$PATH export COMPOSER_PACKAGE_NAME='${{ inputs.composer_package_name }}' - python -m pip install --upgrade pip wheel - python -m pip install --upgrade .${{ inputs.pip_deps }} + pip install uv + uv pip install --upgrade pip wheel + uv pip install --upgrade .${{ inputs.pip_deps }} - name: Run Tests id: tests shell: bash diff --git a/.github/actions/pytest-gpu/action.yaml b/.github/actions/pytest-gpu/action.yaml index fd276c2..a181342 100644 --- a/.github/actions/pytest-gpu/action.yaml +++ b/.github/actions/pytest-gpu/action.yaml @@ -71,21 +71,18 @@ runs: uses: actions/setup-python@v4 with: python-version: ${{ inputs.python_version }} - - name: Cache pip - uses: actions/cache@v3 - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- + - name: Activate virtualenv + shell: bash + run: | + python -m venv .venv + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: Setup MCLI shell: bash run: | set -ex - python -m pip install mosaicml-cli + pip install uv + uv pip install --system mosaicml-cli mcli version - name: Submit Run id: tests @@ -98,7 +95,6 @@ runs: CODE_EVAL_APIKEY: ${{ inputs.code_eval_apikey }} run: | set -ex - PR_NUMBER="$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" REF_ARGS="" @@ -131,7 +127,6 @@ runs: MOSAICML_API_KEY: ${{ inputs.mcloud_api_key }} run: | set -ex - python .github/mcli/follow_mcli_logs.py \ --name '${{ steps.tests.outputs.RUN_NAME }}' - name: Stop Run if Cancelled @@ -141,6 +136,5 @@ runs: MOSAICML_API_KEY: ${{ inputs.mcloud_api_key }} run: | set -ex - python .github/mcli/cancel_mcli_run.py \ --name '${{ steps.tests.outputs.RUN_NAME }}' diff --git a/.github/actions/smoketest/action.yaml b/.github/actions/smoketest/action.yaml index 43b2727..d978700 100644 --- a/.github/actions/smoketest/action.yaml +++ b/.github/actions/smoketest/action.yaml @@ -9,13 +9,20 @@ runs: - uses: actions/setup-python@v4 with: python-version: ${{ inputs.python_version }} + - name: Activate virtualenv + shell: bash + run: | + python -m venv .venv + . .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: Setup shell: bash run: | set -ex - python -m pip install --upgrade pip wheel - python -m pip install --upgrade . - python -m pip install pytest==7.2.1 pytest_codeblocks==0.16.1 + pip install uv + uv pip install --upgrade pip wheel + uv pip install --upgrade . + uv pip install pytest==7.2.1 pytest_codeblocks==0.16.1 - name: Run checks shell: bash run: | diff --git a/.github/mcli/mcli_pytest.py b/.github/mcli/mcli_pytest.py index d8b11cd..8621a12 100644 --- a/.github/mcli/mcli_pytest.py +++ b/.github/mcli/mcli_pytest.py @@ -64,7 +64,11 @@ export COMPOSER_PACKAGE_NAME='{args.pip_package_name}' - pip install --upgrade --user .{args.pip_deps} + python -m venv --system-site-packages .venv + . .venv/bin/activate + + pip install uv + uv pip install --upgrade --no-build-isolation .{args.pip_deps} export COMMON_ARGS="-v --durations=20 -m '{args.pytest_markers}' {clear_tmp_path_flag}" '''