Skip to content

Commit 093fb09

Browse files
thomas-manginclaude
andcommitted
Build: Migrate to uv for dependency management
Replaces pip-based dependency management with uv across all workflows and documentation. Updates CI workflows to use uv sync with lock file caching. Adds sync_requirements.sh script to maintain qa/requirements.txt compatibility. Updates pyproject.toml to use dependency-groups format. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1b4a155 commit 093fb09

File tree

14 files changed

+302
-252
lines changed

14 files changed

+302
-252
lines changed

.claude/CI_TESTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Run ALL tests before declaring code ready.
1212

1313
**Individual commands (for debugging only):**
1414
```bash
15-
ruff format src && ruff check src
16-
env exabgp_log_enable=false pytest ./tests/unit/
15+
uv run ruff format src && uv run ruff check src
16+
env exabgp_log_enable=false uv run pytest ./tests/unit/
1717
./qa/bin/functional encoding
1818
./qa/bin/functional decoding
1919
./sbin/exabgp validate -nrv ./etc/exabgp/conf-ipself6.conf
@@ -59,5 +59,6 @@ killall -9 Python # macOS uses capital P
5959

6060
All must pass:
6161
- Linting (Python 3.12)
62-
- Unit tests (Python 3.8-3.12)
63-
- Functional tests (Python 3.8-3.12)
62+
- Type checking (Python 3.12)
63+
- Unit tests (Python 3.10-3.13)
64+
- Functional tests (Python 3.10-3.13)

.github/workflows/functional-testing.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ jobs:
3030
run: |
3131
python --version
3232
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v4
35+
with:
36+
enable-cache: true
37+
cache-dependency-glob: "uv.lock"
38+
3339
- name: Install dependencies
34-
run: |
35-
python -m pip install --no-cache-dir --upgrade pip
36-
pip install --no-cache-dir -r requirements.txt
37-
pip install psutil
40+
run: uv sync --frozen
3841

3942
- name: Configuration
4043
run: |

.github/workflows/linting.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ jobs:
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828

29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v4
31+
with:
32+
enable-cache: true
33+
cache-dependency-glob: "uv.lock"
34+
2935
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install -r qa/requirements.txt
36+
run: uv sync --frozen
3337

3438
- name: ruff
3539
run: |
3640
python --version
37-
ruff --version
38-
ruff check src qa tests --output-format=full --statistics
41+
uv run ruff --version
42+
uv run ruff check src qa tests --output-format=full --statistics
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Sync requirements.txt
2+
3+
on:
4+
push:
5+
paths:
6+
- 'uv.lock'
7+
- 'pyproject.toml'
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
sync:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- uses: astral-sh/setup-uv@v4
23+
24+
- name: Generate requirements.txt
25+
run: uv export --no-hashes --format requirements-txt > qa/requirements.txt
26+
27+
- name: Commit if changed
28+
run: |
29+
git config user.name "github-actions[bot]"
30+
git config user.email "github-actions[bot]@users.noreply.github.com"
31+
git add qa/requirements.txt
32+
if git diff --staged --quiet; then
33+
echo "No changes to qa/requirements.txt"
34+
else
35+
git commit -m "Sync qa/requirements.txt from uv.lock"
36+
git push
37+
fi

.github/workflows/type-checking.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v4
30+
with:
31+
enable-cache: true
32+
cache-dependency-glob: "uv.lock"
33+
2834
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install -r qa/requirements.txt
35+
run: uv sync --frozen
3236

3337
- name: Strict modules type check (BLOCKING)
3438
run: |
3539
echo "Checking locked modules with strict settings..."
36-
mypy src/exabgp/util src/exabgp/data src/exabgp/environment src/exabgp/logger
40+
uv run mypy src/exabgp/util src/exabgp/data src/exabgp/environment src/exabgp/logger
3741
3842
- name: Type ignore regression check (BLOCKING)
3943
run: |
@@ -43,8 +47,8 @@ jobs:
4347
- name: Full codebase type check (informational)
4448
run: |
4549
python --version
46-
mypy --version
47-
mypy src/exabgp/ --no-error-summary 2>&1 | head -100 || true
50+
uv run mypy --version
51+
uv run mypy src/exabgp/ --no-error-summary 2>&1 | head -100 || true
4852
continue-on-error: true
4953

5054
- name: Type checking summary

.github/workflows/unit-testing.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ jobs:
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v4
34+
with:
35+
enable-cache: true
36+
cache-dependency-glob: "uv.lock"
37+
3238
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install -r qa/requirements.txt
39+
run: uv sync --frozen
3640

3741
- name: pytest
3842
run: |
39-
env PYTHONPATH=src exabgp_log_enable=false pytest --cov --cov-reset ./tests/unit/test_*.py ./tests/fuzz/test_*.py
43+
env PYTHONPATH=src exabgp_log_enable=false uv run pytest --cov --cov-reset ./tests/unit/test_*.py ./tests/fuzz/test_*.py

CLAUDE.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,32 @@ Question 2 (if new commits since backport review):
103103

104104
## Development Commands
105105

106+
### Setup
107+
108+
**First time setup:**
109+
```bash
110+
# Install uv (if not already installed)
111+
curl -LsSf https://astral.sh/uv/install.sh | sh
112+
113+
# Install dependencies
114+
uv sync
115+
```
116+
117+
**Update dependencies:**
118+
```bash
119+
uv lock # Update lock file
120+
./qa/bin/sync_requirements.sh # Sync qa/requirements.txt
121+
```
122+
106123
### Testing
107124

108125
```bash
109126
# ALL tests (required before declaring success)
110127
./qa/bin/test_everything
111128

112129
# Individual (for debugging only)
113-
ruff format src && ruff check src
114-
env exabgp_log_enable=false pytest ./tests/unit/
130+
uv run ruff format src && uv run ruff check src
131+
env exabgp_log_enable=false uv run pytest ./tests/unit/
115132
./qa/bin/functional encoding # ALL 72 tests
116133
./qa/bin/functional decoding
117134
./sbin/exabgp validate -nrv ./etc/exabgp/conf-ipself6.conf
@@ -173,8 +190,8 @@ echo "<hex>" | ./sbin/exabgp decode # From stdin
173190
### Linting
174191

175192
```bash
176-
ruff format src # Single quotes, 120 char
177-
ruff check src # Must pass
193+
uv run ruff format src # Single quotes, 120 char
194+
uv run ruff check src # Must pass
178195
```
179196

180197
### Port Conflicts

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ exabgp-cli = 'exabgp.application.cli:main'
4747
exabgp-healthcheck = 'exabgp.application.healthcheck:main'
4848

4949

50-
[tool.uv]
51-
environments = ["sys_platform == 'darwin'", "sys_platform == 'linux'"]
52-
dev-dependencies = [
50+
[dependency-groups]
51+
dev = [
5352
"ruff",
5453
"mypy",
5554
"pytest",
@@ -63,6 +62,9 @@ dev-dependencies = [
6362
"pytest-timeout>=2.0",
6463
]
6564

65+
[tool.uv]
66+
environments = ["sys_platform == 'darwin'", "sys_platform == 'linux'"]
67+
6668

6769
[build-system]
6870
requires = ["setuptools", "wheel"]

qa/bin/cover

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#/bin/sh
2-
env exabgp_log_enable=false pytest --cov --cov-reset --cov-report=html ./tests/*_test.py
1+
#!/bin/sh
2+
env exabgp_log_enable=false uv run pytest --cov --cov-reset --cov-report=html ./tests/*_test.py

qa/bin/sync_requirements.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
# Sync qa/requirements.txt from uv.lock
3+
# Run this after updating dependencies with uv lock or uv add
4+
5+
set -e
6+
7+
echo "Generating qa/requirements.txt from uv.lock..."
8+
uv export --no-hashes --format requirements-txt > qa/requirements.txt
9+
echo "✓ Synced qa/requirements.txt from uv.lock"

0 commit comments

Comments
 (0)