From fa50931bad5275a420cb396c95607c9972a36945 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Mar 2026 07:36:07 -0700 Subject: [PATCH 1/2] Migrate from legacy installer to uv for dependency management Replace legacy installer with uv across Makefile and CI workflows: - Makefile: use uv for package installation - pr.yaml: Add setup-uv action to Test and SmokeTest jobs - push.yaml: Add setup-uv action to versioning, Test, and Publish jobs Lint jobs already used uv (via uvx ruff). This completes the migration. Supersedes #431. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/pr.yaml | 18 +++++++++++------- .github/workflows/push.yaml | 8 +++++++- Makefile | 2 +- changelog.d/migrate-to-uv.changed.md | 1 + 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 changelog.d/migrate-to-uv.changed.md diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b8bcfafe..65a38086 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -45,6 +45,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Install package run: make install - name: Run tests @@ -70,23 +72,25 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Install -core package run: | - python -m pip install . - python -m pip install "pytest-rerunfailures>=10,<15" + uv pip install --system . + uv pip install --system "pytest-rerunfailures>=10,<15" - name: Verify pytest plugins run: python -m pytest --version - name: Install -us package from PyPI run: | if [[ "${{ matrix.python-version }}" == "3.13" || "${{ matrix.python-version }}" == "3.14" ]]; then # For Python 3.13+, install newer tables first and ignore conflicts - pip install "tables>=3.11.0" - pip install policyengine-us --no-deps + uv pip install --system "tables>=3.11.0" + uv pip install --system policyengine-us --no-deps # Install remaining dependencies manually (skip pytest-dependency which has build issues) - pip install click pathlib synthimpute tabulate - pip install policyengine-us-data --no-deps + uv pip install --system click pathlib synthimpute tabulate + uv pip install --system policyengine-us-data --no-deps else - python -m pip install policyengine-us + uv pip install --system policyengine-us fi shell: bash - name: Run smoke tests only diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index b9422f88..12934ba7 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -28,9 +28,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.14" + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Build changelog run: | - pip install towncrier + uv pip install --system towncrier python .github/bump_version.py towncrier build --yes --version $(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") - name: Preview changelog update @@ -54,6 +56,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.14" + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Install package run: make install - name: Run tests @@ -80,6 +84,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.14" + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Publish a git tag run: ".github/publish-git-tag.sh || true" - name: Install package diff --git a/Makefile b/Makefile index 05e9ccb7..9f188b8a 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ format: ruff check . install: - pip install -e ".[dev]" --config-settings editable_mode=compat + uv pip install -e ".[dev]" --config-settings editable_mode=compat test-country-template: policyengine-core test policyengine_core/country_template/tests -c policyengine_core.country_template diff --git a/changelog.d/migrate-to-uv.changed.md b/changelog.d/migrate-to-uv.changed.md new file mode 100644 index 00000000..ca57a345 --- /dev/null +++ b/changelog.d/migrate-to-uv.changed.md @@ -0,0 +1 @@ +Migrate from pip to uv for dependency management in Makefile and CI workflows. From 3c6f31599984b677808889f683d1b68e7e71931e Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Mar 2026 12:21:23 -0700 Subject: [PATCH 2/2] Add --system flag to uv pip install in Makefile CI runners use system Python without a venv, so uv needs --system. Co-Authored-By: Claude Opus 4.6 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9f188b8a..e774214b 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ format: ruff check . install: - uv pip install -e ".[dev]" --config-settings editable_mode=compat + uv pip install --system -e ".[dev]" --config-settings editable_mode=compat test-country-template: policyengine-core test policyengine_core/country_template/tests -c policyengine_core.country_template