Skip to content

Commit

Permalink
WIP: See if we can use uv lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Nov 26, 2024
1 parent 36eab77 commit dff7bde
Show file tree
Hide file tree
Showing 3 changed files with 4,854 additions and 20 deletions.
28 changes: 10 additions & 18 deletions .github/actions/install-aiida-core/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ inputs:
required: false
# NOTE: Hard-learned lesson: we cannot use type=boolean here, apparently :-(
# https://stackoverflow.com/a/76294014
# TODO: Rename this to 'from-lock'
from-requirements:
description: Install aiida-core dependencies from pre-compiled requirements.txt file
description: Install aiida-core dependencies from a uv lock file
default: 'true'
required: false

Expand All @@ -25,26 +26,17 @@ runs:
with:
python-version: ${{ inputs.python-version }}

- name: Install uv installer
run: curl --proto '=https' --tlsv1.2 -LsSf https://${{ env.UV_URL }} | sh
env:
UV_VERSION: 0.2.9
UV_URL: github.com/astral-sh/uv/releases/download/$UV_VERSION/uv-installer.sh
shell: bash
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: 0.5.4

- name: Install dependencies from requirements-py-*.txt
- name: Install dependencies from uv lock
if: ${{ inputs.from-requirements == 'true' }}
run: uv pip install --system -r requirements/requirements-py-${{ inputs.python-version }}.txt
run: uv sync --locked
shell: bash

- name: Install aiida-core
run: uv pip install --system ${{ env.NO_DEPS }} -e .${{ inputs.extras }}
env:
# Don't install dependencies if they were installed through requirements file AND
# if no extras are required.
#
# If this syntax looks weird to you, dear reader, know that this is
# GHA's way to do ternary operator. :-/
# https://docs.github.com/en/actions/learn-github-actions/expressions#example
NO_DEPS: ${{ (inputs.from-requirements == 'true' && inputs.extras == '') && '--no-deps' || '' }}
if: ${{ inputs.from-requirements != 'true' }}
run: uv pip install --system -e .${{ inputs.extras }}
shell: bash
5 changes: 3 additions & 2 deletions .github/workflows/ci-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- name: Install utils/ dependencies
run: pip install -r utils/requirements.txt

# TODO: Change this to make sure that the lock is up-to-date
- name: Check requirements files
id: check_reqs
run: python ./utils/dependency_management.py check-requirements DEFAULT
Expand Down Expand Up @@ -104,7 +105,7 @@ jobs:
AIIDA_WARN_v3: 1
# Python 3.12 has a performance regression when running with code coverage
# so run code coverage only for python 3.9.
run: pytest --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}
run: uv run pytest --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}

- name: Upload coverage report
if: matrix.python-version == 3.9 && github.repository == 'aiidateam/aiida-core'
Expand Down Expand Up @@ -139,7 +140,7 @@ jobs:
- name: Run test suite
env:
AIIDA_WARN_v3: 0
run: pytest -m 'presto' tests/
run: uv run pytest -m 'presto' tests/


verdi:
Expand Down
Loading

0 comments on commit dff7bde

Please sign in to comment.