Skip to content

Commit 7715d78

Browse files
Merge pull request #38 from virtualcell/switch-to-uv
Switch to UV Build System
2 parents bb49d6d + 61016a1 commit 7715d78

26 files changed

Lines changed: 5969 additions & 4411 deletions

.github/actions/setup-poetry-env/action.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "setup-uv-env"
2+
description: "Composite action to setup the Python and uv environment."
3+
4+
inputs:
5+
python-version:
6+
required: false
7+
description: "The python version to use"
8+
default: "3.11"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up python
14+
uses: actions/setup-python@v6
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
18+
- name: Install UV
19+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
20+
shell: bash
21+
22+
- name: Load cached venv
23+
id: cached-uv-dependencies
24+
uses: actions/cache@v4
25+
if: github.run_attempt == 1
26+
with:
27+
path: .venv
28+
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('uv.lock') }}
29+
30+
- name: Install dependencies
31+
if: github.run_attempt > 1 || steps.cached-uv-dependencies.outputs.cache-hit != 'true'
32+
run: uv sync --all-groups
33+
shell: bash

.github/workflows/main.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
2121

2222
- name: Set up the environment
23-
uses: ./.github/actions/setup-poetry-env
23+
uses: ./.github/actions/setup-uv-env
2424

2525
- name: Run checks
2626
run: make check
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
python-version: ["3.9", "3.10", "3.11", "3.12"]
32+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3333
fail-fast: false
3434
defaults:
3535
run:
@@ -39,18 +39,21 @@ jobs:
3939
uses: actions/checkout@v4
4040

4141
- name: Set up the environment
42-
uses: ./.github/actions/setup-poetry-env
42+
uses: ./.github/actions/setup-uv-env
4343
with:
4444
python-version: ${{ matrix.python-version }}
4545

4646
- name: Install xvfb
4747
run: sudo apt-get update && sudo apt-get install -y xvfb
4848

49+
- name: Sync uv project
50+
run: uv sync --all-groups
51+
4952
- name: Run tests
50-
run: xvfb-run poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
53+
run: xvfb-run uv run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
5154

5255
- name: Check typing
53-
run: poetry run mypy
56+
run: uv run mypy
5457

5558
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
5659
uses: codecov/codecov-action@v4
@@ -63,7 +66,7 @@ jobs:
6366
uses: actions/checkout@v4
6467

6568
- name: Set up the environment
66-
uses: ./.github/actions/setup-poetry-env
69+
uses: ./.github/actions/setup-uv-env
6770

6871
- name: Check if documentation can be built
69-
run: poetry run mkdocs build -s
72+
run: uv run mkdocs build -s

.github/workflows/on-release-main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@v4
1414

1515
- name: Set up the environment
16-
uses: ./.github/actions/setup-poetry-env
16+
uses: ./.github/actions/setup-uv-env
1717

1818
- name: Export tag
1919
id: vars
@@ -22,7 +22,7 @@ jobs:
2222
- name: Build and publish
2323
run: |
2424
source .venv/bin/activate
25-
poetry version $RELEASE_VERSION
25+
uv version $RELEASE_VERSION
2626
make build-and-publish
2727
env:
2828
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/checkout@v4
3737

3838
- name: Set up the environment
39-
uses: ./.github/actions/setup-poetry-env
39+
uses: ./.github/actions/setup-uv-env
4040

4141
- name: Deploy documentation
42-
run: poetry run mkdocs gh-deploy --force
42+
run: uv run mkdocs gh-deploy --force

Makefile

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
.PHONY: install
2-
install: ## Install the poetry environment and install the pre-commit hooks
3-
@echo "🚀 Creating virtual environment using pyenv and poetry"
4-
@poetry install
5-
@ poetry run pre-commit install
6-
@poetry shell
2+
install: ## Install the uv environment and install the pre-commit hooks
3+
@echo "🚀 Creating virtual environment using uv"
4+
@uv sync
5+
@uv run pre-commit install
76

87
.PHONY: check
98
check: ## Run code quality tools.
10-
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry check --lock"
11-
@poetry check --lock
9+
@echo "🚀 Checking UV lock file consistency with 'pyproject.toml': Running uv lock --check"
10+
@uv lock --check
1211
@echo "🚀 Linting code: Running pre-commit"
13-
@poetry run pre-commit run -a
12+
@uv run pre-commit run -a
1413
@echo "🚀 Static type checking: Running mypy"
15-
@poetry run mypy
14+
@uv run mypy
1615
@echo "🚀 Checking for obsolete dependencies: Running deptry"
17-
@poetry run deptry --exclude=.venv --exclude=.venv_jupyter --exclude=examples --exclude=tests .
16+
@uv run deptry --exclude=.venv --exclude=.venv_jupyter --exclude=examples --exclude=tests .
1817

1918
.PHONY: test
2019
test: ## Test the code with pytest
2120
@echo "🚀 Testing code: Running pytest"
22-
@poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml
21+
@uv run pytest --cov --cov-config=pyproject.toml --cov-report=xml
2322

2423
.PHONY: build
25-
build: clean-build ## Build wheel file using poetry
24+
build: clean-build ## Build wheel file using uv
2625
@echo "🚀 Creating wheel file"
27-
@poetry build
26+
@uv build
2827

2928
.PHONY: clean-build
3029
clean-build: ## clean build artifacts
@@ -33,26 +32,25 @@ clean-build: ## clean build artifacts
3332
.PHONY: publish
3433
publish: ## publish a release to pypi.
3534
@echo "🚀 Publishing: Dry run."
36-
@poetry config pypi-token.pypi $(PYPI_TOKEN)
37-
@poetry publish --dry-run
35+
@uv publish --dry-run --token $(PYPI_TOKEN)
3836
@echo "🚀 Publishing."
39-
@poetry publish
37+
@uv publish --token $(PYPI_TOKEN)
4038

4139
.PHONY: build-and-publish
4240
build-and-publish: build publish ## Build and publish.
4341

4442
.PHONY: docs-execute-notebooks
4543
docs-execute-notebooks: ## Execute guide notebooks and save outputs
4644
@echo "🚀 Executing guide notebooks"
47-
@poetry run jupyter nbconvert --to notebook --execute --inplace $(filter-out docs/guides/notebooks/remote-simulations.ipynb,$(wildcard docs/guides/notebooks/*.ipynb))
45+
@uv run jupyter nbconvert --to notebook --execute --inplace $(filter-out docs/guides/notebooks/remote-simulations.ipynb,$(wildcard docs/guides/notebooks/*.ipynb))
4846

4947
.PHONY: docs-test
5048
docs-test: ## Test if documentation can be built without warnings or errors
51-
@poetry run mkdocs build -s
49+
@uv run mkdocs build -s
5250

5351
.PHONY: docs
5452
docs: ## Build and serve the documentation
55-
@poetry run mkdocs serve
53+
@uv run mkdocs serve
5654

5755
.PHONY: help
5856
help:
0 Bytes
Loading
625 Bytes
Loading
0 Bytes
Loading
625 Bytes
Loading
0 Bytes
Loading

0 commit comments

Comments
 (0)