Skip to content

Commit 56b3783

Browse files
yuzhichangclaude
andcommitted
feat(ci): use uv for Python dependency management
Use uv (astral.sh/setup-uv@v2) instead of actions/setup-python for managing Python build dependencies in CI. This simplifies Python version management and speeds up CI builds. Changes: - Add .python-version (Python 3.12) - Add pyproject.toml for build dependencies (setuptools, wheel) - Update release.yml: replace setup-python with setup-uv across all 4 jobs - Update CONTRIBUTING.md with Python/uv setup instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6a89f67 commit 56b3783

4 files changed

Lines changed: 66 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,18 @@ jobs:
4949
node-version: '22'
5050
cache: 'pnpm'
5151

52-
- name: Setup Python 3.11 for node-gyp
53-
uses: actions/setup-python@v5
52+
- name: Install uv
53+
uses: astral-sh/setup-uv@v2
5454
with:
55-
python-version: '3.11'
55+
version: "0.11.3"
5656

57-
- name: Install Python build deps (setuptools shim for distutils)
57+
- name: Set up Python
5858
run: |
59-
python -m pip install --upgrade pip setuptools wheel
60-
echo "python=$(which python3)" >> $GITHUB_ENV
59+
uv python install
60+
echo "python=$(uv python find)" >> $GITHUB_ENV
61+
62+
- name: Install Python build deps
63+
run: uv pip install .
6164

6265
- name: Install dependencies (strict lockfile)
6366
env:
@@ -192,15 +195,18 @@ jobs:
192195
node-version: '22'
193196
cache: 'pnpm'
194197

195-
- name: Setup Python 3.11 for node-gyp
196-
uses: actions/setup-python@v5
198+
- name: Install uv
199+
uses: astral-sh/setup-uv@v2
197200
with:
198-
python-version: '3.11'
201+
version: "0.11.3"
199202

200-
- name: Install Python build deps (setuptools)
203+
- name: Set up Python
201204
run: |
202-
python -m pip install --upgrade pip setuptools wheel
203-
echo "python=$(which python3)" >> $GITHUB_ENV
205+
uv python install
206+
echo "python=$(uv python find)" >> $GITHUB_ENV
207+
208+
- name: Install Python build deps
209+
run: uv pip install .
204210

205211
- name: Install system build dependencies
206212
run: |
@@ -305,16 +311,20 @@ jobs:
305311
node-version: '20'
306312
cache: 'pnpm'
307313

308-
- name: Setup Python 3.11 for node-gyp
309-
uses: actions/setup-python@v5
314+
- name: Install uv
315+
uses: astral-sh/setup-uv@v2
310316
with:
311-
python-version: '3.11'
317+
version: "0.11.3"
312318

313-
- name: Install Python build deps (setuptools shim for distutils)
319+
- name: Set up Python
314320
shell: bash
315321
run: |
316-
python -m pip install --upgrade pip setuptools wheel
317-
echo "python=$(which python)" >> "$GITHUB_ENV"
322+
uv python install
323+
echo "python=$(uv python find)" >> "$GITHUB_ENV"
324+
325+
- name: Install Python build deps
326+
shell: bash
327+
run: uv pip install .
318328

319329
- name: Install dependencies (strict lockfile)
320330
shell: bash
@@ -479,15 +489,18 @@ jobs:
479489
node-version: '22'
480490
cache: 'pnpm'
481491

482-
- name: Setup Python 3.11 for node-gyp
483-
uses: actions/setup-python@v5
492+
- name: Install uv
493+
uses: astral-sh/setup-uv@v2
484494
with:
485-
python-version: '3.11'
495+
version: "0.11.3"
486496

487-
- name: Install Python build deps (setuptools shim for distutils)
497+
- name: Set up Python
488498
run: |
489-
python -m pip install --upgrade pip setuptools wheel
490-
echo "python=$(which python3)" >> $GITHUB_ENV
499+
uv python install
500+
echo "python=$(uv python find)" >> $GITHUB_ENV
501+
502+
- name: Install Python build deps
503+
run: uv pip install .
491504

492505
- name: Install dependencies (strict lockfile)
493506
env:

.python-version

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

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,26 @@ Thanks for your interest in contributing! We favor small, focused PRs and clear
77
Prerequisites
88

99
- **Node.js 20.0.0+ (recommended: 22.20.0)** and Git
10+
- **Python 3.11+** with [uv](https://docs.astral.sh/uv/) (for native module builds)
1011
- Optional (recommended for end‑to‑end testing):
1112
- GitHub CLI (`brew install gh`; then `gh auth login`)
1213
- At least one supported coding agent CLI (see docs for list)
1314

15+
### Python Setup
16+
17+
This project uses [uv](https://docs.astral.sh/uv/) to manage Python build dependencies. Install uv first, then the project will automatically use the Python version specified in `.python-version`:
18+
19+
```bash
20+
# Install uv (Linux/macOS)
21+
curl -LsSf https://astral.sh/uv/install.sh | sh
22+
23+
# Or on Windows (PowerShell)
24+
powershell -ExecutionPolicy Bypass -c "irm https://astral.sh/uv/install.ps1 | iex"
25+
26+
# Python dependencies are installed automatically via 'pnpm install'
27+
# or manually: uv pip install .
28+
```
29+
1430
Setup
1531

1632
```bash

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[project]
2+
name = "emdash-build-deps"
3+
version = "0.0.0"
4+
requires-python = ">=3.12"
5+
dependencies = [
6+
"setuptools>=67.0",
7+
"wheel",
8+
]
9+
10+
[build-system]
11+
requires = ["setuptools>=67.0", "wheel"]
12+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)