Skip to content

Commit 13cccbb

Browse files
authored
fix pyproject2conda and modernize CI (#78)
1 parent 8a09d00 commit 13cccbb

8 files changed

Lines changed: 1436 additions & 1270 deletions

File tree

.github/workflows/docs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@v6
2525

2626
- name: Install System Dependencies (GDAL)
2727
run: |
2828
sudo apt-get update
2929
sudo apt-get install -y libgdal-dev g++
3030
3131
- name: Install uv
32-
uses: astral-sh/setup-uv@v5
32+
uses: astral-sh/setup-uv@v8.1.0
3333
with:
3434
enable-cache: true
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
3536

3637
- name: Set up Python
3738
run: uv python install
@@ -48,7 +49,7 @@ jobs:
4849
uv run sphinx-build -b html docs/source docs/build/html
4950
5051
- name: Upload artifact
51-
uses: actions/upload-pages-artifact@v3
52+
uses: actions/upload-pages-artifact@v4
5253
with:
5354
path: ./docs/build/html
5455

@@ -62,4 +63,4 @@ jobs:
6263
steps:
6364
- name: Deploy to GitHub Pages
6465
id: deployment
65-
uses: actions/deploy-pages@v4
66+
uses: actions/deploy-pages@v5

.github/workflows/python-package.yml

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,22 @@ jobs:
2424
name: "📝 Pre-commit / Code Quality"
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
28-
- name: ⚡ Install uv
29-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
27+
- uses: actions/checkout@v6
28+
- name: ⚡ Setup uv
29+
uses: astral-sh/setup-uv@v8.1.0
30+
with:
31+
enable-cache: true
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
cache-suffix: ${{ github.job }}
3034
- name: 🏃 Run Pre-commit
3135
run: |
3236
uv tool install pre-commit
3337
uv tool run pre-commit run --show-diff-on-failure --all-files
34-
35-
setup:
36-
name: "🏗️ Build Py${{ matrix.python-version }}"
37-
needs: lint
38-
runs-on: ubuntu-latest
39-
strategy:
40-
matrix:
41-
python-version: ["3.10", "3.11", "3.12", "3.13"]
42-
container: ghcr.io/osgeo/gdal:ubuntu-small-latest
43-
steps:
44-
- uses: actions/checkout@v4
45-
46-
- name: 📥 Apply Dependency Overrides
47-
if: "${{ inputs.override-deps-artifact != '' && inputs.override-deps-artifact != 'null' }}"
48-
uses: actions/download-artifact@v4
49-
with:
50-
name: ${{ inputs.override-deps-artifact }}
51-
52-
- name: ⚡ Install uv
53-
run: |
54-
apt-get update && apt-get install -y curl
55-
curl -LsSf https://astral.sh/uv/install.sh | BINDIR=/usr/local/bin sh
56-
57-
- name: 📝 Export Locked Requirements
58-
run: |
59-
uv export --frozen --all-extras --format requirements-txt > requirements.txt
60-
61-
- name: 📤 Upload Requirements
62-
uses: actions/upload-artifact@v4
63-
with:
64-
name: frozen-reqs-${{ matrix.python-version }}
65-
path: requirements.txt
66-
retention-days: 1
38+
- name: 🧹 Cache Prune
39+
run: uv cache prune --ci
6740

6841
test:
69-
needs: setup
42+
needs: lint
7043
name: "🧪 py${{ matrix.python-version }} [${{ matrix.split }}/4]"
7144
runs-on: ubuntu-latest
7245
strategy:
@@ -84,24 +57,24 @@ jobs:
8457
# Fix "Dubious Ownership" error (Required for containerized Git)
8558
git config --global --add safe.directory '*'
8659
87-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v6
8861

89-
- name: 📥 Download Requirements
90-
uses: actions/download-artifact@v4
62+
- name: 📥 Apply Dependency Overrides
63+
if: "${{ inputs.override-deps-artifact != '' && inputs.override-deps-artifact != 'null' }}"
64+
uses: actions/download-artifact@v8
9165
with:
92-
name: frozen-reqs-${{ matrix.python-version }}
66+
name: ${{ inputs.override-deps-artifact }}
9367

94-
- name: ⚡ Install uv
95-
run: |
96-
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="/usr/local/bin" sh
97-
98-
uv --version
68+
- name: ⚡ Setup uv
69+
uses: astral-sh/setup-uv@v8.1.0
70+
with:
71+
enable-cache: true
72+
github-token: ${{ secrets.GITHUB_TOKEN }}
73+
cache-suffix: ${{ matrix.python-version }}-${{ matrix.split }}
9974

100-
- name: 🏗️ Restore Native Env
75+
- name: 🏗️ Sync Environment
10176
run: |
102-
uv venv --python ${{ matrix.python-version }}
103-
uv pip install -r requirements.txt
104-
uv pip install -e ".[test]" --no-deps
77+
uv sync --frozen --all-extras --python ${{ matrix.python-version }}
10578
10679
- name: 🧪 Run Tests (Split ${{ matrix.split }}/4)
10780
env:
@@ -131,7 +104,7 @@ jobs:
131104

132105
- name: 📤 Upload Coverage Chunk (Latest Only)
133106
if: matrix.python-version == '3.13'
134-
uses: actions/upload-artifact@v4
107+
uses: actions/upload-artifact@v7
135108
with:
136109
name: coverage-chunk-${{ matrix.split }}
137110
path: .coverage.python.${{ matrix.python-version }}.test.split.${{ matrix.split }}
@@ -140,25 +113,32 @@ jobs:
140113

141114
- name: 📤 Archive JUnit Results
142115
if: always()
143-
uses: actions/upload-artifact@v4
116+
uses: actions/upload-artifact@v7
144117
with:
145118
name: results-${{ matrix.python-version }}-${{ matrix.split }}
146119
path: pytest-${{ matrix.python-version }}-${{ matrix.split }}.xml
147120
retention-days: 1
148121

122+
- name: 🧹 Cache Prune
123+
run: uv cache prune --ci
124+
149125
summary:
150126
name: "📊 Final Summary & Coverage"
151127
needs: test
152128
if: always()
153129
runs-on: ubuntu-latest
154130
steps:
155-
- uses: actions/checkout@v4 # Needed for coverage to see source files
131+
- uses: actions/checkout@v6 # Needed for coverage to see source files
156132

157-
- name: ⚡ Install uv
158-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
133+
- name: ⚡ Setup uv
134+
uses: astral-sh/setup-uv@v8.1.0
135+
with:
136+
enable-cache: true
137+
github-token: ${{ secrets.GITHUB_TOKEN }}
138+
cache-suffix: ${{ github.job }}
159139

160140
- name: 📥 Download Artifacts
161-
uses: actions/download-artifact@v4
141+
uses: actions/download-artifact@v8
162142
with:
163143
path: all-results
164144
pattern: "*-*"
@@ -226,4 +206,4 @@ jobs:
226206
else
227207
echo "✅ **Coverage Passed:** 80% coverage achieved (Py3.13)." >> $GITHUB_STEP_SUMMARY
228208
exit 0
229-
fi
209+
fi

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v6
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: '3.x'
2121
- name: Install dependencies

.github/workflows/sync-dependencies.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,28 @@ jobs:
2121
outputs:
2222
sync_needed: ${{ steps.check.outputs.changed }}
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v6
2525
with:
2626
fetch-depth: 0
2727
ref: ${{ github.event.pull_request.head.ref || github.ref }}
2828

2929
- name: ⚡ Setup uv
30-
uses: astral-sh/setup-uv@v5
30+
uses: astral-sh/setup-uv@v8.1.0
31+
with:
32+
enable-cache: true
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
3135

3236
- name: 🛠️ Upgrade & Sync
3337
run: |
34-
# Robust repair: if the lockfile is out of sync/corrupted, fix it, then upgrade everything
35-
uv lock || (rm uv.lock && uv lock)
38+
# Upgrade lockfile
3639
uv lock --upgrade
3740
3841
# Sync the conda recipe
39-
uvx pyproject2conda yaml -f pyproject.toml --output conda/meta.yaml --python-include infer
42+
uvx pyproject2conda yaml --pyproject pyproject.toml --output conda/meta.yaml --python-include infer
43+
44+
- name: 🧹 Cache Prune
45+
run: uv cache prune --ci
4046

4147
- name: 📋 Check for Changes
4248
id: check
@@ -84,7 +90,7 @@ jobs:
8490
8591
- name: 📤 Upload Updated Deps
8692
if: steps.check.outputs.changed == 'true'
87-
uses: actions/upload-artifact@v4
93+
uses: actions/upload-artifact@v7
8894
with:
8995
name: updated-deps
9096
retention-days: 1
@@ -111,14 +117,14 @@ jobs:
111117
contents: write
112118
pull-requests: write
113119
steps:
114-
- uses: actions/checkout@v4
120+
- uses: actions/checkout@v6
115121
with:
116122
fetch-depth: 0
117123
ref: ${{ github.event.pull_request.head.ref || github.ref }}
118124
token: ${{ secrets.MAPCHETE_PAT_CONTAINER_IMAGES_TOKEN }}
119125

120126
- name: 📥 Download Verified Artifacts
121-
uses: actions/download-artifact@v4
127+
uses: actions/download-artifact@v8
122128
with:
123129
name: updated-deps
124130

CHANGELOG.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ Changelog
33
#########
44

55

6+
Unreleased
7+
----------
8+
9+
* CI/CD
10+
11+
* modernize workflows for `uv 0.5+`
12+
* upgrade all GitHub Actions to May 2026 versions (utilizing Node.js 24)
13+
* standardized on `astral-sh/setup-uv@v8.1.0` (immutable release)
14+
* fix GitHub API rate limit issues by providing `GITHUB_TOKEN` to `setup-uv`
15+
* fix CI cache reservation collisions in parallel test matrix using `cache-suffix`
16+
* use `uv sync --frozen` for test environment management
17+
* enable `uv` caching and add `uv cache prune --ci` steps
18+
19+
620
2026.3.0 - 2026-03-06
721
---------------------
822

conda/meta.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pyproject2conda
33
# with the following command:
44
#
5-
# $ pyproject2conda yaml -f pyproject.toml --output conda/meta.yaml --python-include infer
5+
# $ pyproject2conda yaml --pyproject pyproject.toml --output conda/meta.yaml --python-include infer
66
#
77
# You should not manually edit this file.
88
# Instead edit the corresponding pyproject.toml file.
@@ -11,12 +11,12 @@ channels:
1111
- conda-forge
1212
dependencies:
1313
- python>=3.10
14-
- Pillow
1514
- click
1615
- croniter
1716
- lxml
1817
- mapchete>=2025.10.0
19-
- opencv-python-headless
18+
- opencv
19+
- pillow
2020
- pydantic
2121
- pygeofilter
2222
- pystac-client>=0.7.5

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,6 @@ markers = [
104104

105105
[tool.pyproject2conda]
106106
channels = ["conda-forge"]
107-
# Maps PyPI names to Conda-Forge names if they differ
108-
map_deps = { "opencv-python-headless" = "opencv", "pystac-client" = "python-pystac-client" }
107+
108+
[tool.pyproject2conda.dependencies]
109+
opencv-python-headless = { skip = true, packages = "opencv" }

0 commit comments

Comments
 (0)