Skip to content

Commit 1d5f8ee

Browse files
dionhaefnerxalelax
andauthored
chore: Add UV support (#99)
This PR includes all changes to [`pasteur-python-template`](https://github.com/pasteurlabs/pasteur-python-template) from v0.5.1 to v0.6.0. **Conflicting files are automatically overwritten with the template version**. Repo maintainers, please review and cherry-pick changes / restore original files as appropriate before merging. --------- Co-authored-by: Alessandro Angioi <[email protected]>
1 parent 4448548 commit 1d5f8ee

19 files changed

+3313
-131
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
version: 2
22

33
updates:
4-
- package-ecosystem: pip
5-
directory: "/"
6-
schedule:
7-
interval: "weekly"
8-
timezone: "America/New_York"
9-
open-pull-requests-limit: 10
10-
11-
groups:
12-
deps:
13-
patterns:
14-
- "*"
15-
16-
commit-message:
17-
prefix: chore
18-
194
- package-ecosystem: github-actions
205
directory: "/"
216
schedule:
227
interval: "weekly"
8+
day: "monday"
239
timezone: "America/New_York"
2410
open-pull-requests-limit: 10
2511

2612
groups:
2713
actions:
2814
patterns:
2915
- "*"
30-
31-
commit-message:
32-
prefix: ci

.github/workflows/build_docs.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
name: Build documentation
22

33
on:
4+
# run on PRs for validation
45
pull_request:
5-
branches:
6-
- main
76

87
jobs:
98
test-docs:
109
runs-on: ubuntu-latest
1110

1211
steps:
13-
- name: Checkout
12+
- name: Set up Git repository
1413
uses: actions/checkout@v4
1514

1615
- name: Install system requirements
1716
run: |
1817
sudo apt-get update
1918
sudo apt-get install -y pandoc
2019
21-
- name: Setup Python environment
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
enable-cache: true
24+
25+
- name: Set up Python
2226
uses: actions/setup-python@v5
2327
with:
24-
python-version: '3.12'
28+
python-version-file: "pyproject.toml"
29+
30+
- name: Restore UV environment
31+
run: cp production.uv.lock uv.lock
2532

2633
- name: Install doc requirements
2734
run: |
28-
pip install .[dev] -r requirements.txt
29-
pip install -r docs/requirements.txt
35+
uv sync --extra docs --frozen
3036
3137
- name: Build docs
38+
working-directory: docs
3239
run: |
33-
cd docs
3440
export SPHINXOPTS="-W" # treat warnings as errors
35-
make html
41+
uv run --no-sync make html

.github/workflows/bump_lockfile.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Bump UV lockfile
2+
3+
on:
4+
workflow_dispatch: # Allows manual trigger
5+
6+
schedule:
7+
- cron: '0 0 * * 1' # 12AM only on Mondays
8+
9+
jobs:
10+
bump-lockfile:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Set up Git repository
15+
uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
19+
with:
20+
enable-cache: true
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version-file: "pyproject.toml"
26+
27+
- name: Update lockfile
28+
run: |
29+
mv production.uv.lock uv.lock
30+
uv lock --upgrade
31+
mv uv.lock production.uv.lock
32+
33+
- name: Generate new requirements.txt
34+
run : |
35+
pip install pre-commit
36+
pre-commit run update-requirements --all-files || true
37+
38+
- name: Detect if changes were made
39+
id: git-diff
40+
run: |
41+
changes=false
42+
git diff --exit-code || changes=true
43+
echo "update_done=$changes" >> $GITHUB_OUTPUT
44+
45+
- name: Create Pull Request
46+
if: steps.git-diff.outputs.update_done == 'true'
47+
uses: peter-evans/create-pull-request@v7
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
commit-message: Update dependencies
51+
title: 📦 Update dependencies
52+
branch: _bot/update-deps
53+
draft: false
54+
base: main
55+
body: |
56+
This PR updates the lockfile to the latest versions of the dependencies.
57+
Please review the changes and merge when ready.
58+
59+
To trigger CI checks, please close and reopen this PR.

.github/workflows/get_coverage.yml

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

.github/workflows/pre-commit-cron-updater.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Auto update pre-commit hooks
22

33
on:
44
workflow_dispatch: # Allows manual trigger
5+
56
schedule:
67
- cron: '0 0 * * 1' # 12AM only on Mondays
78

@@ -14,8 +15,7 @@ jobs:
1415

1516
- uses: actions/setup-python@v5
1617
with:
17-
python-version: '3.12'
18-
cache: 'pip'
18+
python-version-file: "pyproject.toml"
1919

2020
- name: Install pre-commit
2121
run: pip install pre-commit
@@ -62,7 +62,7 @@ jobs:
6262
with:
6363
token: ${{ secrets.GITHUB_TOKEN }}
6464
commit-message: Update pre-commit hooks
65-
title: "chore: update pre-commit hooks"
65+
title: "chore: ✅ Update pre-commit hooks"
6666
branch: _bot/update-precommit
6767
draft: false
6868
body: |
@@ -74,7 +74,7 @@ jobs:
7474
with:
7575
token: ${{ secrets.GITHUB_TOKEN }}
7676
commit-message: Update pre-commit hooks
77-
title: "chore: update pre-commit hooks [review required]"
77+
title: "chore: ⚠️ Update pre-commit hooks [review required]"
7878
branch: _bot/update-precommit
7979
draft: true
8080
body: |

.github/workflows/pre_commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.12'
18+
python-version-file: "pyproject.toml"
1919
- uses: pre-commit/[email protected]

.github/workflows/publish.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish
22

33
on:
4-
workflow_dispatch:
4+
workflow_dispatch: # Allows manual trigger
55

66
release:
77
types:
@@ -13,10 +13,15 @@ jobs:
1313
runs-on: '${{ matrix.os }}'
1414
strategy:
1515
matrix:
16+
# TODO: Comment in additional platforms if using C extensions / platform-specific wheels
1617
os:
1718
- ubuntu-latest
19+
# - macos-latest
1820
python-version:
19-
- "3.12"
21+
# - "3.10"
22+
# - "3.11"
23+
# - "3.12"
24+
- "3.13"
2025

2126
steps:
2227
- name: Checkout
@@ -27,16 +32,22 @@ jobs:
2732
run: |
2833
git fetch --prune --unshallow --tags
2934
30-
- name: Setup Python
35+
- name: Set up uv
36+
uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
40+
- name: Set up Python
3141
uses: actions/setup-python@v5
3242
with:
3343
python-version: ${{ matrix.python-version }}
3444

35-
- name: Install Build
36-
run: pip install build
45+
- name: Restore UV environment
46+
run: cp production.uv.lock uv.lock
3747

3848
- name: Build Package
39-
run: python -m build
49+
run: |
50+
uv build
4051
4152
- name: Store the distribution packages
4253
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)