Skip to content

Commit 7233578

Browse files
committed
Migrate to uv
Migrates ci from `pip` to `uv`. Revises test and release workflows.
1 parent 500faf7 commit 7233578

File tree

10 files changed

+64
-259
lines changed

10 files changed

+64
-259
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
version: 2
77
updates:
8-
# Configuration for pip
9-
# - package-ecosystem: "pip" # See documentation for possible values
10-
# directory: "/etc/requirements_dependabot" # Location of package manifests
8+
# - package-ecosystem: "uv" # See documentation for possible values
9+
# directory: "/" # Location of package manifests
1110
# schedule:
1211
# interval: "daily"
1312
# for reference:
@@ -23,4 +22,4 @@ updates:
2322
- package-ecosystem: "github-actions" # See documentation for possible values
2423
directory: "/" # Location of package manifests
2524
schedule:
26-
interval: "weekly"
25+
interval: "monthly"

.github/workflows/build-test.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ jobs:
2323
python-version: ["3.9", "3.13"]
2424

2525
steps:
26-
- uses: actions/checkout@v4
27-
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v5
26+
- uses: actions/checkout@v5
27+
- name: Install uv and set the Python version
28+
uses: astral-sh/setup-uv@v6
2929
with:
3030
python-version: ${{ matrix.python-version }}
31-
cache: 'pip'
32-
cache-dependency-path: 'requirements_tests.txt'
33-
- name: Install dependencies
34-
run: |
35-
python -m pip install --upgrade pip
36-
pip install -r requirements_tests.txt
37-
pip install -e .
38-
- name: Test with pytest
39-
# fail it if doesn't pass test suite
40-
run: |
41-
pytest
31+
- name: Enable caching
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
enable-cache: true
35+
36+
- name: Install the project
37+
run: uv sync --locked --group test --no-dev
38+
- name: Run tests
39+
run: uv run pytest

.github/workflows/release.yml

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,46 @@ on:
66
types: [released]
77

88
permissions:
9+
id-token: write
910
contents: read
1011

1112
jobs:
1213
deploy:
1314
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
1417
steps:
15-
- uses: actions/checkout@v4
16-
17-
- name: Set up Python
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: '3.x'
21-
22-
- name: Install build dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install build
26-
27-
- name: Build package
28-
run: python -m build
29-
30-
- name: Publish to Test PyPI
31-
uses: pypa/gh-action-pypi-publish@release/v1
32-
with:
33-
user: __token__
34-
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
35-
repository-url: https://test.pypi.org/legacy/
36-
37-
- name: Install from testpypi and import
38-
run: |
39-
sleep 5
40-
while [ "${{ github.ref_name }}" != $(pip index versions -i https://test.pypi.org/simple --pre valimp | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
41-
do echo "waiting for package to appear in test index, sleeping 5s"; sleep 5s; echo "woken up"; done
42-
pip install --index-url https://test.pypi.org/simple valimp==${{ github.ref_name }} --no-deps
43-
pip install -r requirements.txt
44-
python -c 'import valimp;print(valimp.__version__)'
45-
46-
- name: Clean pip
47-
run: |
48-
pip uninstall -y valimp
49-
pip cache purge
50-
51-
- name: Publish to PyPI
52-
uses: pypa/gh-action-pypi-publish@release/v1
53-
with:
54-
user: __token__
55-
password: ${{ secrets.PYPI_API_TOKEN }}
56-
57-
- name: Install and import
58-
run: |
59-
sleep 5
60-
while [ "${{ github.ref_name }}" != $(pip index versions -i https://pypi.org/simple --pre valimp | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
61-
do echo "waiting for package to appear in index, sleeping 5s"; sleep 5s; echo "woken up"; done
62-
pip install --index-url https://pypi.org/simple valimp==${{ github.ref_name }}
63-
python -c 'import valimp;print(valimp.__version__)'
18+
- uses: actions/checkout@v5
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v6
21+
- name: Install Python
22+
run: uv python install
23+
- name: Build
24+
run: uv build
25+
26+
- name: Publish to Test PyPI
27+
run: uv publish --index testpypi
28+
- name: Check test install and import
29+
run: |
30+
sleep 5 # Wait for Test Pypi to publish
31+
uv run \
32+
--with valimp \
33+
--refresh-package valimp \
34+
--index https://test.pypi.org/simple \
35+
--no-project \
36+
--isolated \
37+
-- \
38+
python -c 'import valimp; print(f"{valimp.__version__=}")'
39+
40+
- name: Publish to PyPI
41+
run: uv publish
42+
- name: Check install and import
43+
run: |
44+
sleep 5 # Wait for Pypi to publish
45+
uv run \
46+
--with valimp \
47+
--refresh-package valimp \
48+
--no-project \
49+
--isolated \
50+
-- \
51+
python -c 'import valimp;print(f"{valimp.__version__=}")'

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.9

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ documentation = "https://github.com/maread99/valimp"
6262

6363
[tool.setuptools_scm]
6464
write_to = "src/valimp/_version.py"
65+
66+
[[tool.uv.index]]
67+
name = "testpypi"
68+
url = "https://test.pypi.org/simple/"
69+
publish-url = "https://test.pypi.org/legacy/"
70+
explicit = true

requirements.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.9
3-
# by the following command:
4-
#
5-
# pip-compile pyproject.toml
6-
#
1+
# This file was autogenerated by uv via the following command:
2+
# uv export --format requirements-txt --no-emit-project --no-hashes --no-dev -o requirements.txt

requirements_dev.txt

Lines changed: 0 additions & 120 deletions
This file was deleted.

requirements_tests.txt

Lines changed: 0 additions & 54 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)