-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Adopt uv for Python Package Management
Related: smartem-decisions#212 (Docker rework - separate scope)
Summary
Migrate smartem-decisions CI/CD and developer tooling from pip to uv. The repo already has uv.lock and release-smartem-decisions.yml uses uv - this work standardizes all workflows.
Note: smartem-devtools already fully adopted uv (no changes needed).
Design Decisions
| Decision | Choice | Rationale |
|---|---|---|
install_requirements action |
Eliminate | uv handles everything better with astral-sh/setup-uv@v7 |
| Tox | Eliminate | Replace with direct uv run pytest/ruff/pyright |
| Pre-commit ruff hooks | Official ruff-pre-commit repo | Portable, auto-updates, no uv dependency for pre-commit |
| Windows builds (PyInstaller) | Keep pip | PyInstaller compatibility concerns |
| Dockerfile | Defer to #212 | Docker rework is separate scope - will use uv there |
Implementation
Phase 1: CI Workflow Migration
1.1 Update _test.yml
File: .github/workflows/_test.yml
Replace pip+tox with uv:
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install ${{ inputs.python-version }}
- name: Install dependencies
run: uv sync --extra all
- name: Run tests
run: uv run pytest --cov --cov-report=xml1.2 Update _schema_drift.yml
File: .github/workflows/_schema_drift.yml
Replace pip install -e .[all] with uv sync --extra all.
1.3 Update _dist.yml
File: .github/workflows/_dist.yml
Replace pipx run build with uv build, pipx run twine with uvx twine.
Phase 2: Remove Obsolete Files
- Delete:
.github/actions/install_requirements/- obsolete with uv - Delete:
.github/workflows/_tox.yml- tox is being removed
Phase 3: Configuration Updates
3.1 Update pre-commit config
File: .pre-commit-config.yaml
Replace local ruff hooks (lines 28-42):
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff
args: [--force-exclude]
- id: ruff-format
args: [--force-exclude]3.2 Update pyproject.toml
File: pyproject.toml
- Remove
tox-directfrom dev dependencies - Remove entire
[tool.tox]section
Phase 4: Documentation Updates
4.1 REPO-GUIDELINES.md
File: claude-config/smartem-decisions/REPO-GUIDELINES.md
Update commands:
| Current | New |
|---|---|
pip install -e .[all] |
uv sync --extra all |
pytest |
uv run pytest |
ruff check |
uv run ruff check |
pyright |
uv run pyright |
4.2 for-developers.md
File: smartem-devtools/docs/getting-started/for-developers.md
Update installation instructions to use uv as primary method.
4.3 tools.md
File: smartem-devtools/docs/development/tools.md
Prefix tool commands with uv run.
Files Summary
Modify
| File | Change |
|---|---|
.github/workflows/_test.yml |
pip+tox → uv |
.github/workflows/_schema_drift.yml |
pip → uv |
.github/workflows/_dist.yml |
pipx → uv/uvx |
.pre-commit-config.yaml |
local ruff → official ruff-pre-commit |
pyproject.toml |
Remove tox config |
REPO-GUIDELINES.md |
Update commands |
for-developers.md |
Update install docs |
tools.md |
Add uv run prefixes |
Delete
| File | Reason |
|---|---|
.github/actions/install_requirements/ |
Obsolete |
.github/workflows/_tox.yml |
Obsolete |
Keep Unchanged
| File | Reason |
|---|---|
release-smartem-decisions.yml |
Already uses uv |
build_win_smartem_agent.yml |
Keep pip for PyInstaller |
uv.lock |
Already exists |
Dockerfile |
Defer to #212 |
Verification
uv sync --extra all- dependencies install correctlyuv run pytest- tests passuv run ruff check src tests- linting worksuv run pyright src tests- type checking workspre-commit run --all-files- hooks pass- CI workflows pass on push to branch
Out of Scope
- Dockerfile: Separate issue #212 (rework Docker to install from PyPI)
- fandanGO-cryoem-dls: Requires coordination with upstream maintainers
- FragmentScreen repos: Read-only, conda-based
- smartem-devtools: Already fully adopted uv
Tasks
- Update
_test.ymlto use uv instead of pip+tox - Update
_schema_drift.ymlto use uv - Update
_dist.ymlto use uv build/uvx twine - Delete
.github/actions/install_requirements/action - Update
.pre-commit-config.yamlto use official ruff-pre-commit - Remove tox config from
pyproject.toml - Update REPO-GUIDELINES.md with uv commands
- Update for-developers.md with uv installation instructions
- Update tools.md with uv run prefixes