Skip to content

Commit

Permalink
Sandbox: Optionally use uv package manager to save cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Nov 1, 2024
1 parent 8a3bf38 commit 447434c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
3 changes: 3 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
cache: 'pip'
cache-dependency-path: 'setup.py'

- name: Install uv
uses: yezz123/setup-uv@v4

- name: Invoke tests
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install uv
uses: yezz123/setup-uv@v4

- name: Invoke tests
run: |
Expand Down
6 changes: 6 additions & 0 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 447434c

Please sign in to comment.