Skip to content

Commit bef2ac3

Browse files
committed
Migrate ci to uv
Also update dependencies.
1 parent aa622f5 commit bef2ac3

10 files changed

Lines changed: 3320 additions & 847 deletions

File tree

.github/dependabot.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
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:
12-
interval: "daily"
11+
interval: "monthly"
12+
allow:
13+
# Allow only direct dependencies (in theory not indirect or sub-dependencies)
14+
- dependency-type: "direct"
15+
groups:
16+
direct-deps:
17+
patterns:
18+
- "*"
1319
# for reference:
1420
# ignore:
1521
# # Ignore updates to packages that start with 'aws'
@@ -23,4 +29,4 @@ updates:
2329
- package-ecosystem: "github-actions" # See documentation for possible values
2430
directory: "/" # Location of package manifests
2531
schedule:
26-
interval: "daily"
32+
interval: "monthly"

.github/workflows/build-test.yml

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

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

.github/workflows/release.yml

Lines changed: 42 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,54 @@
1-
# Workflow to upload a Python Package using Twine when a release is created
2-
name: Release to PyPI
1+
# Workflow to upload a Python Package when a release is created
2+
name: Publish to PyPI
33

44
on:
55
release:
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-
shell: bash
39-
run: |
40-
sleep 5
41-
while [ "${{ github.ref_name }}" != $(pip index versions -i https://test.pypi.org/simple --pre market-analy | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
42-
do echo "waiting for package to appear in test index, sleeping 5s"; sleep 5s; echo "woken up"; done
43-
pip install --index-url https://test.pypi.org/simple market-analy==${{ github.ref_name }} --no-deps
44-
pip install -r etc/requirements.txt
45-
python -c 'import market_analy;print(market_analy.__version__)'
46-
47-
- name: Clean pip
48-
run: |
49-
pip uninstall -y market_analy
50-
pip cache purge
51-
52-
- name: Publish to PyPI
53-
uses: pypa/gh-action-pypi-publish@release/v1
54-
with:
55-
user: __token__
56-
password: ${{ secrets.PYPI_API_TOKEN }}
57-
58-
- name: Install and import
59-
shell: bash
60-
run: |
61-
sleep 5
62-
while [ "${{ github.ref_name }}" != $(pip index versions -i https://pypi.org/simple --pre market-analy | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
63-
do echo "waiting for package to appear in index, sleeping 5s"; sleep 5s; echo "woken up"; done
64-
pip install --index-url https://pypi.org/simple market-analy==${{ github.ref_name }}
65-
python -c 'import market_analy;print(market_analy.__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+
# Include pypi index for deps not available from test pypi...
32+
uv run \
33+
--with market-analy \
34+
--refresh-package market-analy \
35+
--index https://test.pypi.org/simple \
36+
--index https://pypi.org/simple \
37+
--index-strategy unsafe-best-match \
38+
--no-project \
39+
--isolated \
40+
-- \
41+
python -c 'import market_analy; print(f"{market_analy.__version__=}")'
42+
43+
- name: Publish to PyPI
44+
run: uv publish
45+
- name: Check install and import
46+
run: |
47+
sleep 5 # Wait for Pypi to publish
48+
uv run \
49+
--with market-analy \
50+
--refresh-package market-analy \
51+
--no-project \
52+
--isolated \
53+
-- \
54+
python -c 'import market_analy;print(f"{market_analy.__version__=}")'

.python-version

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

etc/requirements_dependabot/requirements_tests.txt

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

0 commit comments

Comments
 (0)