Skip to content

Commit 90c853e

Browse files
authored
Merge pull request #18 from biosimulations/uv
switch from poetry to uv
2 parents 05af6a5 + 6b49859 commit 90c853e

62 files changed

Lines changed: 3265 additions & 5198 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Setup Python Environment"
2+
description: "Set up Python environment for the given Python version"
3+
4+
inputs:
5+
python-version:
6+
description: "Python version to use"
7+
required: true
8+
default: "3.12"
9+
uv-version:
10+
description: "uv version to use"
11+
required: true
12+
default: "0.6.14"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python-version }}
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
version: ${{ inputs.uv-version }}
25+
enable-cache: "true"
26+
cache-suffix: ${{ matrix.python-version }}
27+
28+
- name: Install Python dependencies
29+
run: uv sync --frozen
30+
shell: bash

.github/workflows/main.yml

Lines changed: 9 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-python-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.8", "3.9", "3.10", "3.11", "3.12"]
32+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3333
fail-fast: false
3434
defaults:
3535
run:
@@ -39,19 +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-python-env
4343
with:
4444
python-version: ${{ matrix.python-version }}
4545

4646
- name: Run tests
47-
run: poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
47+
run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
4848

4949
- name: Check typing
50-
run: poetry run mypy
50+
run: uv run mypy
5151

5252
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
5353
uses: codecov/codecov-action@v4
5454
if: ${{ matrix.python-version == '3.11' }}
55+
env:
56+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5557

5658
check-docs:
5759
runs-on: ubuntu-latest
@@ -60,7 +62,7 @@ jobs:
6062
uses: actions/checkout@v4
6163

6264
- name: Set up the environment
63-
uses: ./.github/actions/setup-poetry-env
65+
uses: ./.github/actions/setup-python-env
6466

6567
- name: Check if documentation can be built
66-
run: poetry run mkdocs build -s
68+
run: uv run mkdocs build -s

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: release-main
33
on:
44
release:
55
types: [published]
6-
branches: [main]
76

87
jobs:
98
deploy-docs:
@@ -13,7 +12,7 @@ jobs:
1312
uses: actions/checkout@v4
1413

1514
- name: Set up the environment
16-
uses: ./.github/actions/setup-poetry-env
15+
uses: ./.github/actions/setup-python-env
1716

1817
- name: Deploy documentation
19-
run: poetry run mkdocs gh-deploy --force
18+
run: uv run mkdocs gh-deploy --force

.github/workflows/validate-codecov-config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
validate-codecov-config:
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Validate codecov configuration

.gitignore

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ docs/source
44

55
# Byte-compiled / optimized / DLL files
66
__pycache__/
7-
*.py[cod]
7+
*.py[codz]
88
*$py.class
99

1010
# C extensions
@@ -50,7 +50,7 @@ htmlcov/
5050
nosetests.xml
5151
coverage.xml
5252
*.cover
53-
*.py,cover
53+
*.py.cover
5454
.hypothesis/
5555
.pytest_cache/
5656
cover/
@@ -98,20 +98,35 @@ ipython_config.py
9898
# install all needed dependencies.
9999
#Pipfile.lock
100100

101+
# UV
102+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
#uv.lock
106+
101107
# poetry
102108
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103109
# This is especially recommended for binary packages to ensure reproducibility, and is more
104110
# commonly ignored for libraries.
105111
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106112
#poetry.lock
113+
#poetry.toml
107114

108115
# pdm
109116
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
118+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
110119
#pdm.lock
111-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112-
# in version control.
113-
# https://pdm.fming.dev/#use-with-ide
114-
.pdm.toml
120+
#pdm.toml
121+
.pdm-python
122+
.pdm-build/
123+
124+
# pixi
125+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
126+
#pixi.lock
127+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
128+
# in the .venv directory. It is recommended not to include this directory in version control.
129+
.pixi
115130

116131
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117132
__pypackages__/
@@ -125,6 +140,7 @@ celerybeat.pid
125140

126141
# Environments
127142
.env
143+
.envrc
128144
.venv
129145
env/
130146
venv/
@@ -156,6 +172,44 @@ dmypy.json
156172
# Cython debug symbols
157173
cython_debug/
158174

175+
# PyCharm
176+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
177+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178+
# and can be added to the global gitignore or merged into this file. For a more nuclear
179+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
180+
#.idea/
181+
182+
# Abstra
183+
# Abstra is an AI-powered process automation framework.
184+
# Ignore directories containing user credentials, local state, and settings.
185+
# Learn more at https://abstra.io/docs
186+
.abstra/
187+
188+
# Visual Studio Code
189+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
190+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
191+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
192+
# you could uncomment the following to ignore the entire vscode folder
193+
# .vscode/
194+
195+
# Ruff stuff:
196+
.ruff_cache/
197+
198+
# PyPI configuration file
199+
.pypirc
200+
201+
# Cursor
202+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
203+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
204+
# refer to https://docs.cursor.com/context/ignore-files
205+
.cursorignore
206+
.cursorindexingignore
207+
208+
# Marimo
209+
marimo/_static/
210+
marimo/_lsp/
211+
__marimo__/
212+
159213
# Vscode config files
160214
.vscode/
161215

.pre-commit-config.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: "v4.4.0"
3+
rev: "v5.0.0"
44
hooks:
55
- id: check-case-conflict
66
- id: check-merge-conflict
77
- id: check-toml
88
- id: check-yaml
99
exclude: ^kustomize/
10+
- id: check-json
11+
- id: pretty-format-json
12+
args: [--autofix, --no-sort-keys]
1013
- id: end-of-file-fixer
1114
- id: trailing-whitespace
1215

1316
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: "v0.5.2"
17+
rev: "v0.11.5"
1518
hooks:
1619
- id: ruff
1720
args: [--exit-non-zero-on-fix]
1821
- id: ruff-format
19-
20-
- repo: https://github.com/pre-commit/mirrors-prettier
21-
rev: "v3.0.3"
22-
hooks:
23-
- id: prettier

CONTRIBUTING.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Anything tagged with "enhancement" and "help wanted" is open to whoever wants to
2929

3030
## Write Documentation
3131

32-
Cookiecutter PyPackage could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.
32+
compose-api could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.
3333

3434
## Submit Feedback
3535

@@ -45,7 +45,7 @@ If you are proposing a new feature:
4545
# Get Started!
4646

4747
Ready to contribute? Here's how to set up `compose-api` for local development.
48-
Please note this documentation assumes you already have `poetry` and `Git` installed and ready to go.
48+
Please note this documentation assumes you already have `uv` and `Git` installed and ready to go.
4949

5050
1. Fork the `compose-api` repo on GitHub.
5151

@@ -62,23 +62,16 @@ git clone git@github.com:YOUR_NAME/compose-api.git
6262
cd compose-api
6363
```
6464

65-
If you are using `pyenv`, select a version to use locally. (See installed versions with `pyenv versions`)
66-
67-
```bash
68-
pyenv local <x.y.z>
69-
```
70-
7165
Then, install and activate the environment with:
7266

7367
```bash
74-
poetry install
75-
poetry shell
68+
uv sync
7669
```
7770

7871
4. Install pre-commit to run linters/formatters at commit time:
7972

8073
```bash
81-
poetry run pre-commit install
74+
uv run pre-commit install
8275
```
8376

8477
5. Create a branch for local development:

Dockerfile-api

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ RUN apt-get update && \
77
rm -rf /var/lib/apt/lists/*
88

99
# Set environment variables
10-
ENV POETRY_VERSION=2.1.3 \
11-
POETRY_VIRTUALENVS_CREATE=false \
12-
PYTHONUNBUFFERED=1
10+
ENV PYTHONUNBUFFERED=1
1311

12+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
1413

15-
# Install Poetry
16-
RUN pip install "poetry==$POETRY_VERSION"
17-
18-
# Set the working directory
14+
# Change the working directory to the `app` directory
1915
WORKDIR /app
2016

21-
# Copy only the necessary files
22-
COPY pyproject.toml poetry.lock /app/
17+
# Copy the lockfile and `pyproject.toml` into the image
18+
COPY uv.lock /app/uv.lock
19+
COPY pyproject.toml /app/pyproject.toml
2320

2421
# Install dependencies
25-
RUN poetry install --no-root --only main
22+
RUN uv sync --frozen --no-install-project
2623

27-
# Copy the rest of the application code
24+
# Copy the project into the image
2825
COPY . /app
2926

27+
# Sync the project
28+
RUN uv sync --frozen
29+
3030
# Declare the volume for local cache storage
3131
VOLUME ["/app/scratch"]
3232

0 commit comments

Comments
 (0)