From 41bf3520dfbad1754f513d2130e4922cf91546f6 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Sat, 30 Nov 2024 08:11:54 +0400 Subject: [PATCH] align with uv documentation --- actions/setup-environment-uv/action.yml | 44 ------------------------- actions/uv/coverage/action.yml | 4 +-- actions/uv/deptry/action.yml | 4 +-- actions/uv/marimo/action.yml | 6 ++-- actions/uv/setup/action.yml | 19 ++++++----- actions/uv/sphinx/action.yml | 4 +-- actions/uv/test/action.yml | 3 +- 7 files changed, 21 insertions(+), 63 deletions(-) delete mode 100644 actions/setup-environment-uv/action.yml diff --git a/actions/setup-environment-uv/action.yml b/actions/setup-environment-uv/action.yml deleted file mode 100644 index 532bfc0..0000000 --- a/actions/setup-environment-uv/action.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2023 Stanford University Convex Optimization Group -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -name: Setup the Python Environment - -description: "Construct a Python environment for ci/cd using uv" - -on: - workflow_call: - inputs: - python-version: - description: 'Python version' - type: string - required: false - default: '3.12' - -runs: - using: "composite" - steps: - - name: Install uv - uses: astral-sh/setup-uv@v3 - with: - # Install a specific version of uv. - version: "0.5.4" - - - name: Set up Python ${{ inputs.python-version || '3.12' }} - shell: bash - run: | - uv python install ${{ inputs.python-version || '3.12' }} - - - name: Install the project - shell: bash - run: | - uv sync --all-extras --dev diff --git a/actions/uv/coverage/action.yml b/actions/uv/coverage/action.yml index c8b7ca7..321e0b9 100644 --- a/actions/uv/coverage/action.yml +++ b/actions/uv/coverage/action.yml @@ -32,13 +32,13 @@ runs: - name: Test on Linux shell: bash run: | - pip install --no-cache-dir \ + uv pip install --no-cache-dir \ pytest \ pytest-cov \ pytest-html \ pytest-random-order - pytest --cov=${{ inputs.source-folder || 'cvx' }} --random-order --verbose \ + uv run pytest --cov=${{ inputs.source-folder || 'cvx' }} --random-order --verbose \ --html=artifacts/tests/html-report/report.html \ --cov-report term \ --cov-report xml:artifacts/tests/coverage/coverage.xml \ diff --git a/actions/uv/deptry/action.yml b/actions/uv/deptry/action.yml index 171895e..a27f386 100644 --- a/actions/uv/deptry/action.yml +++ b/actions/uv/deptry/action.yml @@ -32,9 +32,9 @@ runs: - name: Install deptry shell: bash run: | - pip install --no-cache-dir deptry + uv pip install --no-cache-dir deptry - name: Run deptry shell: bash run : | - deptry ${{ inputs.source-folder || 'cvx' }} + uv run deptry ${{ inputs.source-folder || 'cvx' }} diff --git a/actions/uv/marimo/action.yml b/actions/uv/marimo/action.yml index 6942f11..a3aaad6 100644 --- a/actions/uv/marimo/action.yml +++ b/actions/uv/marimo/action.yml @@ -33,7 +33,7 @@ runs: - name: Install marimo shell: bash run: | - pip install marimo + uv pip install marimo - name: Convert *.py files in book/marimo folder to html files @@ -56,8 +56,8 @@ runs: # Convert to HTML echo "Converting $file to HTML..." - marimo export html "$file" -o "artifacts/marimo/${filename}.html" - marimo export md "$file" -o "artifacts/marimo/${filename}.md" + uv run marimo export html "$file" -o "artifacts/marimo/${filename}.html" + uv run marimo export md "$file" -o "artifacts/marimo/${filename}.md" done - name: Archive marimo html diff --git a/actions/uv/setup/action.yml b/actions/uv/setup/action.yml index 8b05aa5..bb8743f 100644 --- a/actions/uv/setup/action.yml +++ b/actions/uv/setup/action.yml @@ -27,18 +27,19 @@ on: runs: using: "composite" steps: - - name: Setup Python - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v4 with: - python-version: ${{ inputs.python-version || '3.12' }} + version: "0.5.5" + #enable-cache: 'true' + #cache-local-path: '/tmp/cache' + #cache-dependency-glob: 'uv.lock' - - name: Install UV + - name: Set up Python shell: bash - run: | - pip install uv + run: uv python install ${{ inputs.python-version || '3.12' }} - - name: Install Dependencies + - name: Install the project shell: bash run: | - uv pip install -r requirements.txt --system - uv pip install -e . --system + uv sync --all-extras --dev diff --git a/actions/uv/sphinx/action.yml b/actions/uv/sphinx/action.yml index a69aa33..30f72e6 100644 --- a/actions/uv/sphinx/action.yml +++ b/actions/uv/sphinx/action.yml @@ -33,7 +33,7 @@ runs: - name: Install sphinx shell: bash run: | - pip install --no-cache-dir \ + uv pip install --no-cache-dir \ sphinx==7.2.6 \ sphinx-autoapi \ sphinx-rtd-theme @@ -41,7 +41,7 @@ runs: - name: Build sphinx shell: bash run: | - sphinx-build -b html ${{ inputs.sphinx-folder || 'book/sphinx' }} artifacts/sphinx + uv run sphinx-build -b html ${{ inputs.sphinx-folder || 'book/sphinx' }} artifacts/sphinx - name: Archive sphinx documentation uses: actions/upload-artifact@v4 diff --git a/actions/uv/test/action.yml b/actions/uv/test/action.yml index 83e38e0..1ed38cc 100644 --- a/actions/uv/test/action.yml +++ b/actions/uv/test/action.yml @@ -36,4 +36,5 @@ runs: - name: Test shell: bash run: | - pytest tests + uv pip install pytest + uv run pytest tests