Skip to content

Commit 7f86016

Browse files
authored
Merge pull request #447 from linkml/migrate-to-uv-clean
Migrate to uv clean
2 parents c62747f + 679af5d commit 7f86016

File tree

10 files changed

+1800
-1359
lines changed

10 files changed

+1800
-1359
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ updates:
88
schedule:
99
interval: monthly
1010

11-
# Activate after migration to uv as package manager
12-
# - package-ecosystem: "uv"
13-
# directories:
14-
# - "/"
15-
# schedule:
16-
# interval: "weekly"
17-
# day: "sunday"
18-
# groups:
19-
# # Individual pull requests for major/minor updates and grouped for patch updates
20-
# angular:
21-
# applies-to: version-updates
22-
# patterns:
23-
# - "*"
24-
# update-types:
25-
# - "patch"
26-
# open-pull-requests-limit: 10
11+
- package-ecosystem: "uv"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
day: "sunday"
16+
groups:
17+
# Individual pull requests for major/minor updates and grouped for patch updates
18+
dependencies:
19+
applies-to: version-updates
20+
patterns:
21+
- "*"
22+
update-types:
23+
- "patch"
24+
open-pull-requests-limit: 10

.github/workflows/check-dependencies.yaml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Build and test linkml-runtime with latest dependency versions
2-
2+
env:
3+
UV_VERSION: "0.7.13"
34
on:
45
schedule:
56
- cron: '0 5 * * 1' # once per week on Monday at 05:00 UTC
@@ -12,15 +13,14 @@ jobs:
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@4.2.2
15-
- name: Install Poetry
16-
run: |
17-
pipx install poetry
18-
pipx inject poetry poetry-dynamic-versioning
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
with:
19+
version: ${{ env.UV_VERSION }}
20+
enable-cache: true
1921
- uses: actions/setup-python@v5.6.0
2022
with:
2123
python-version: 3.13
22-
- name: Check pyproject.toml and poetry.lock
23-
run: poetry check
2424
- name: Install tox
2525
run: python -m pip install tox
2626
- name: Run codespell
@@ -47,10 +47,13 @@ jobs:
4747
runs-on: ${{ matrix.os }}
4848

4949
steps:
50-
- name: Install Poetry
51-
run: |
52-
pipx install poetry
53-
pipx inject poetry poetry-dynamic-versioning
50+
- name: Install uv
51+
uses: astral-sh/setup-uv@v6
52+
with:
53+
enable-cache: true
54+
version: ${{ env.UV_VERSION }}
55+
python-version: ${{ matrix.python-version }}
56+
5457

5558
- name: Check out repository
5659
uses: actions/checkout@v4.2.2
@@ -59,21 +62,13 @@ jobs:
5962
# The tags are required for dynamic versioning.
6063
fetch-depth: 0
6164

62-
- name: Set up Python ${{ matrix.python-version }}
63-
uses: actions/setup-python@v5.6.0
64-
with:
65-
python-version: ${{ matrix.python-version }}
66-
cache: 'poetry'
67-
68-
- name: Install library
69-
run: poetry install --no-interaction
65+
- name: Regenerate lock file with latest dependencies
66+
run: uv lock --upgrade
7067

71-
- name: Regenerating poetry.lock file & install (sync) dependencies
72-
run: |
73-
poetry lock --regenerate
74-
poetry sync
68+
- name: Install dependencies
69+
run: uv sync --group dev
7570

7671
- name: Run tests
7772
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
7873
shell: bash
79-
run: poetry run python -m pytest --with-slow
74+
run: uv run -m pytest --with-slow

.github/workflows/main.yaml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
# https://github.com/codecov/codecov-action
55

66
name: Build and test linkml-runtime
7-
7+
env:
8+
UV_VERSION: "0.7.13"
89
on:
910
push:
1011
branches:
@@ -17,15 +18,14 @@ jobs:
1718
runs-on: ubuntu-latest
1819
steps:
1920
- uses: actions/checkout@4.2.2
20-
- name: Install Poetry
21-
run: |
22-
pipx install poetry
23-
pipx inject poetry poetry-dynamic-versioning
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
version: ${{ env.UV_VERSION }}
25+
enable-cache: true
2426
- uses: actions/setup-python@v5.6.0
2527
with:
2628
python-version: 3.13
27-
- name: Check pyproject.toml and poetry.lock
28-
run: poetry check
2929
- name: Install tox
3030
run: python -m pip install tox
3131
- name: Run codespell
@@ -62,28 +62,41 @@ jobs:
6262
with:
6363
fetch-depth: 0
6464

65-
66-
- name: Install Poetry
67-
run: |
68-
pipx install poetry
69-
pipx inject poetry poetry-dynamic-versioning
70-
71-
- name: Set up Python ${{ matrix.python-version }}
72-
uses: actions/setup-python@v5.6.0
65+
#----------------------------------------------
66+
# install uv
67+
#----------------------------------------------
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v6
7370
with:
71+
version: ${{ env.UV_VERSION }}
72+
enable-cache: true
73+
cache-dependency-glob: "uv.lock"
7474
python-version: ${{ matrix.python-version }}
75-
cache: 'poetry'
7675

77-
- name: Install library
76+
#----------------------------------------------
77+
# install your root project, if required
78+
#----------------------------------------------
79+
- name: Install dependencies
7880
run: |
79-
poetry install --no-interaction
81+
uv sync --group dev
82+
83+
- name: Verify uv.lock is up-to-date
84+
run: uv lock --check
85+
86+
#----------------------------------------------
87+
# coverage report
88+
#----------------------------------------------
8089
- name: Generate coverage results
8190
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
8291
shell: bash
8392
run: |
84-
poetry run coverage run -m pytest
85-
poetry run coverage xml
86-
poetry run coverage report -m
93+
uv run coverage run -m pytest
94+
uv run coverage xml
95+
uv run coverage report -m
96+
97+
#----------------------------------------------
98+
# upload coverage results
99+
#----------------------------------------------
87100
- name: Upload coverage report
88101
uses: codecov/codecov-action@v5
89102
with:

.github/workflows/pypi-publish.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Publish Python Package
22
# Upload to PyPI is triggered by creating & publishing a release in GitHub UI
3-
3+
env:
4+
UV_VERSION: "0.7.13"
45
on:
56
release:
67
# Trigger the workflow only for real releases but not for draft releases
@@ -21,14 +22,15 @@ jobs:
2122
with:
2223
python-version: 3.13
2324

24-
- name: Install Poetry
25-
run: |
26-
pipx install poetry
27-
pipx inject poetry poetry-dynamic-versioning
25+
- name: Install uv
26+
uses: astral-sh/setup-uv@v6
27+
with:
28+
enable-cache: true
29+
version: ${{ env.UV_VERSION }}
2830

2931
- name: Build source and wheel archives
3032
run: |
31-
poetry build
33+
uv build
3234
3335
- name: Store built distribution
3436
uses: actions/upload-artifact@v4.6.2

.github/workflows/test-upstream.yaml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Test linkml-runtime with upstream linkml and run linkml tests
22
name: Test with upstream linkml
3+
env:
4+
UV_VERSION: "0.7.13"
35
on:
46
pull_request:
57
workflow_dispatch:
@@ -28,8 +30,6 @@ jobs:
2830
- os: windows-latest
2931
python-version: "3.12"
3032
runs-on: ${{ matrix.os }}
31-
env:
32-
POETRY_VIRTUALENVS_IN_PROJECT: true
3333

3434
steps:
3535
- name: Get upstream branch and repo from first lines of PR Body
@@ -109,43 +109,33 @@ jobs:
109109
git remote add upstream https://github.com/linkml/linkml-runtime
110110
git fetch upstream --tags
111111
112-
- name: set up python
113-
uses: actions/setup-python@v5.6.0
112+
- name: Install uv
113+
uses: astral-sh/setup-uv@v6
114114
with:
115+
enable-cache: true
116+
version: ${{ env.UV_VERSION }}
115117
python-version: ${{ matrix.python-version }}
116118

117-
- name: Install poetry
118-
run: |
119-
pipx install poetry
120-
pipx inject poetry poetry-dynamic-versioning
121-
122-
- name: Load cached venv
123-
id: cached-poetry-dependencies
124-
uses: actions/cache@v4.2.3
125-
with:
126-
path: linkml/.venv
127-
key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
128-
129119
# we are not using linkml-runtime's lockfile, but simulating what will happen
130120
# when we merge this and update linkml's lockfile
131121
- name: add linkml-runtime to lockfile
132122
working-directory: linkml
133-
run: poetry add ../linkml-runtime
123+
run: uv add ../linkml-runtime
134124

135125
# note that we run the installation step always, even if we restore a venv,
136126
# the cache will restore the old version of linkml-runtime, but the lockfile
137127
# will only store the directory dependency (and thus will reinstall it)
138128
# the cache will still speedup the rest of the installation
139129
- name: install linkml
140130
working-directory: linkml
141-
run: poetry sync --no-interaction --all-extras
131+
run: uv sync --all-groups
142132

143133
- name: print linkml-runtime version
144134
working-directory: linkml
145-
run: poetry run python -c 'import linkml_runtime; from importlib.metadata import version; print(linkml_runtime.__file__); print(version("linkml_runtime"))'
135+
run: uv run python -c 'import linkml_runtime; from importlib.metadata import version; print(linkml_runtime.__file__); print(version("linkml_runtime"))'
146136

147137
- name: run linkml tests
148138
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
149139
shell: bash
150140
working-directory: linkml
151-
run: poetry run python -m pytest --with-slow
141+
run: uv run -m pytest --with-slow

CONTRIBUTING.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ are correct and expected given the context of the PR.
6868

6969
## Development environment setup
7070

71-
1. Install [poetry](https://python-poetry.org/docs/#installation).
72-
2. Install all the dependencies from your project, which are typically specified in a `poetry.lock` file.
71+
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/).
72+
2. Install all the dependencies from your project, which are typically specified in a `uv.lock` file.
7373

7474
```
75-
poetry install
75+
uv sync --all-extras --dev
7676
```
7777

78-
3. Run any python scripts or CLI commands by prefixing with `poetry run`.
78+
3. Run any python scripts or CLI commands by prefixing with `uv run`.
7979

8080
```
81-
poetry run python your_script.py # ex of how to run standalone python script
82-
poetry run pytest # ex of how to invoke CLI tools
81+
uv run python your_script.py # ex of how to run standalone python script
82+
uv run pytest # ex of how to invoke CLI tools
8383
```
8484

85-
4. Refer to the poetry docs for details on how to use the [add](https://python-poetry.org/docs/cli/#add), [update](https://python-poetry.org/docs/cli/#update) and [remove](https://python-poetry.org/docs/cli/#remove) commands.
86-
85+
4. Refer to the uv docs for details on how to use the [add](https://docs.astral.sh/uv/concepts/dependencies/), [update](https://docs.astral.sh/uv/concepts/dependencies/#updating-dependencies) and
86+
[remove](https://docs.astral.sh/uv/concepts/dependencies/#removing-dependencies) commands.
8787
## Release process
8888

8989
Once the code has been merged into the `main` branch on this repo, there are a few steps that need to be completed to ensure a release is complete.
@@ -105,21 +105,21 @@ All code added to the linkml-runtime source must have tests. The repo uses the n
105105
You can run the test suite in the following way:
106106

107107
```
108-
poetry run python -m pytest
108+
uv run python -m pytest
109109
```
110110

111111
### Upstream Testing
112112

113113
To run the upstream `linkml` tests against your branch,
114-
install `linkml` locally with poetry, and then manually install your
114+
install `linkml` locally with uv, and then manually install your
115115
local copy of `linkml-runtime`
116116

117117
```shell
118118
git clone https://github.com/linkml/linkml
119119
cd linkml
120-
poetry install --all-extras --with tests
121-
poetry run pip install -e ~/location/of/linkml-runtime
122-
poetry run pytest
120+
uv sync --all-extras
121+
uv add ~/location/of/linkml-runtime
122+
uv run pytest
123123
```
124124

125125
## Code style

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ update_model:
1010
cp -pr $(MODEL_DIR)/* linkml_runtime/linkml_model
1111

1212
test:
13-
poetry run pytest
13+
uv run pytest
1414

1515

1616
# temporary measure until linkml-model is synced

0 commit comments

Comments
 (0)