From 2abbb4dc1564c853271dc1df8d0fae91d7e490a4 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Thu, 31 Oct 2024 17:33:14 +0100 Subject: [PATCH] Sandbox: Optionally use `uv` package manager to save cycles --- .github/workflows/codeql.yml | 5 ++++- .github/workflows/nightly.yml | 3 +++ .github/workflows/release.yml | 9 ++++++--- .github/workflows/tests.yml | 3 +++ DEVELOP.rst | 6 ++++++ bootstrap.sh | 13 +++++++++++++ 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0beeba05..ddd76302 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -43,6 +43,9 @@ jobs: cache-dependency-path: | setup.py + - name: Install uv + uses: yezz123/setup-uv@v4 + - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: @@ -55,7 +58,7 @@ jobs: - name: Install project run: | - pip install --editable=.[test] + uv pip install --editable=.[test] - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ccb65d9d..6bb9c2d9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -32,6 +32,9 @@ jobs: cache: 'pip' cache-dependency-path: 'setup.py' + - name: Install uv + uses: yezz123/setup-uv@v4 + - name: Invoke tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a62e7df..b00c58d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,11 +18,14 @@ jobs: cache: 'pip' cache-dependency-path: 'setup.py' + - name: Install uv + uses: yezz123/setup-uv@v4 + - name: Build package run: | - python -m pip install twine wheel - python setup.py sdist bdist_wheel - twine check dist/*.tar.gz + uv pip install build twine wheel + python -m build + twine check dist/* - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83c7e0ff..3f109900 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,6 +47,9 @@ jobs: cache: 'pip' cache-dependency-path: setup.py + - name: Install uv + uses: yezz123/setup-uv@v4 + - name: Invoke tests run: | diff --git a/DEVELOP.rst b/DEVELOP.rst index 41373f18..28a25b2a 100644 --- a/DEVELOP.rst +++ b/DEVELOP.rst @@ -5,6 +5,12 @@ CrateDB Python developer guide Setup ===== +Optionally install Python package and project manager ``uv``, +in order to significantly speed up the package installation:: + + {apt,brew,pip,zypper} install uv + alias pip="uv pip" + To start things off, bootstrap the sandbox environment:: git clone https://github.com/crate/crate-python diff --git a/bootstrap.sh b/bootstrap.sh index 9e011195..6547e931 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -87,12 +87,25 @@ function finalize() { } +function activate_uv() { + if command -v uv; then + function pip() { + uv pip "$@" + } + fi +} +function deactivate_uv() { + unset -f pip +} + function main() { + activate_uv ensure_virtualenv activate_virtualenv before_setup setup_package run_buildout + deactivate_uv finalize }