Skip to content

Commit 0914f53

Browse files
committed
Switch CI from Poetry to uv and drop Python 3.9
1 parent 8026f3d commit 0914f53

3 files changed

Lines changed: 76 additions & 58 deletions

File tree

.github/workflows/deploy_documentation.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,32 @@ jobs:
2828
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
2929

3030
- name: Set up Python3
31-
uses: actions/setup-python@v3
31+
uses: actions/setup-python@v5
3232
with:
33-
python-version: 3.9
33+
python-version: '3.11'
3434

3535
#----------------------------------------------
36-
# install & configure poetry
36+
# install uv
3737
#----------------------------------------------
38-
- name: Install Poetry
39-
uses: snok/install-poetry@v1.3
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v5
40+
with:
41+
enable-cache: true
4042

4143
#----------------------------------------------
42-
# install dependencies if cache does not exist
44+
# create env and install deps
4345
#----------------------------------------------
4446
- name: Install dependencies
45-
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
46-
run: poetry install --no-interaction
47+
run: |
48+
uv venv
49+
uv pip install . \
50+
mkdocs \
51+
"linkml>=1.7.4" \
52+
mkdocs-mermaid2-plugin \
53+
jupyter \
54+
ipython-sql \
55+
tox \
56+
black
4757
4858
#----------------------------------------------
4959
# Create documentation and deploy.
@@ -53,5 +63,5 @@ jobs:
5363
mkdir docs
5464
touch docs/.nojekyll
5565
cp -r src/docs/* docs/
56-
make gendoc
57-
make mkd-gh-deploy
66+
make RUN="uv run" gendoc
67+
make RUN="uv run" mkd-gh-deploy

.github/workflows/main.yaml

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Built from:
2-
# https://docs.github.com/en/actions/guides/building-and-testing-python
3-
# https://github.com/snok/install-poetry#workflows-and-tips
4-
51
name: Build and test
62

73
on:
@@ -15,73 +11,65 @@ jobs:
1511
runs-on: ubuntu-latest
1612
strategy:
1713
matrix:
18-
python-version: [ '3.9' ]
14+
python-version: [ '3.11' ]
1915
steps:
20-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
2117
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
2319
with:
2420
python-version: ${{ matrix.python-version }}
25-
- name: Install dependencies
26-
run: |
27-
pip install tox
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
enable-cache: true
25+
- name: Create virtual environment
26+
run: uv venv
27+
- name: Install lint dependencies
28+
run: uv pip install tox
2829
- name: Check code quality with flake8
29-
run: tox -e flake8
30+
run: uv run tox -e flake8
3031

3132
test:
3233
runs-on: ubuntu-latest
3334
strategy:
3435
matrix:
35-
python-version: [ '3.9' ]
36+
python-version: [ '3.11' ]
3637

3738
steps:
3839

3940
#----------------------------------------------
4041
# check-out repo and set-up python
4142
#----------------------------------------------
4243
- name: Check out repository
43-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
4445

4546
- name: Set up Python ${{ matrix.python-version }}
46-
uses: actions/setup-python@v3
47+
uses: actions/setup-python@v5
4748
with:
4849
python-version: ${{ matrix.python-version }}
4950

5051
#----------------------------------------------
51-
# install & configure poetry
52+
# install uv
5253
#----------------------------------------------
53-
- name: Install Poetry
54-
uses: snok/install-poetry@v1.3
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v5
5556
with:
56-
virtualenvs-create: true
57-
virtualenvs-in-project: true
57+
enable-cache: true
5858

5959
#----------------------------------------------
60-
# load cached venv if cache exists
60+
# create virtualenv
6161
#----------------------------------------------
62-
- name: Load cached venv
63-
id: cached-poetry-dependencies
64-
uses: actions/cache@v3
65-
with:
66-
path: .venv
67-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
62+
- name: Create virtual environment
63+
run: uv venv
6864

6965
#----------------------------------------------
70-
# install dependencies if cache does not exist
66+
# install dependencies
7167
#----------------------------------------------
7268
- name: Install dependencies
73-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
74-
run: poetry install --no-interaction --no-root
75-
76-
#----------------------------------------------
77-
# install your root project, if required
78-
#----------------------------------------------
79-
- name: Install library
80-
run: poetry install --no-interaction
69+
run: uv pip install .
8170

8271
#----------------------------------------------
8372
# run test suite
8473
#----------------------------------------------
8574
- name: Run tests
86-
run: poetry run python -m unittest discover
87-
75+
run: uv run python -m unittest discover

.github/workflows/pypi-publish.yaml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,46 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- name: Set up Python
16-
uses: actions/setup-python@v3
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.9
18+
python-version: '3.11'
1919

20-
- name: Install Poetry
21-
uses: snok/install-poetry@v1.3.1
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
2222
with:
23-
virtualenvs-create: true
24-
virtualenvs-in-project: true
23+
enable-cache: true
2524

26-
- name: Install dependencies
27-
run: poetry install --no-interaction
25+
- name: Create virtual environment
26+
run: uv venv
2827

2928
- name: Build source and wheel archives
3029
run: |
31-
poetry version $(git describe --tags --abbrev=0)
32-
poetry build
30+
uv pip install build
31+
VERSION="$(git describe --tags --abbrev=0)"
32+
VERSION="${VERSION#v}"
33+
export VERSION
34+
python - <<'PY'
35+
import os
36+
import re
37+
from pathlib import Path
38+
39+
path = Path("pyproject.toml")
40+
data = path.read_text()
41+
version = os.environ["VERSION"]
42+
updated = re.sub(
43+
r'^version = ".*"$',
44+
f'version = "{version}"',
45+
data,
46+
count=1,
47+
flags=re.MULTILINE,
48+
)
49+
path.write_text(updated)
50+
print(f"Set project version to {version}")
51+
PY
52+
uv run python -m build
3353
3454
- name: Publish distribution 📦 to PyPI
3555
uses: pypa/gh-action-pypi-publish@v1.2.2

0 commit comments

Comments
 (0)