From ad26e9e54c0d5429d7ebc408f9a98611198bb977 Mon Sep 17 00:00:00 2001 From: Tom Gillam Date: Thu, 5 Sep 2024 09:39:44 +0100 Subject: [PATCH] Use uv build (#61) --- .github/workflows/ci.yml | 22 ++++------------------ Makefile | 14 ++++---------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 794101c..2a255f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] + python: [39, 310, 311, 312] steps: - uses: actions/checkout@v4 @@ -25,19 +25,13 @@ jobs: - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Install & activate - run: | - uv sync --python ${{ matrix.python-version }} - . .venv/bin/activate - echo PATH=$PATH >> $GITHUB_ENV - - name: Test - run: python -m unittest discover tests + run: uv run --python ${{ matrix.python }} python -m unittest discover tests - name: Test with oldest-supported-numpy run: | uv pip install oldest-supported-numpy - python -m unittest discover tests + uv run python -m unittest discover tests build_wheels: name: Build wheel for ${{ matrix.os }}-${{ matrix.build }}${{ matrix.python }}-${{ matrix.arch }} @@ -61,7 +55,6 @@ jobs: - name: Checkout mt2 uses: actions/checkout@v4 - # Needed within cibuildwheel - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh @@ -86,13 +79,8 @@ jobs: - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Install environment & setuptools - run: | - uv sync - uv pip install setuptools - - name: Build sdist - run: uv run python setup.py sdist + run: uv build --sdist - uses: actions/upload-artifact@v4 with: @@ -110,8 +98,6 @@ jobs: runs-on: ubuntu-latest # upload to PyPI on every tag starting with 'v' if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') - # alternatively, to publish when a GitHub Release is created, use the following rule: - # if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 with: diff --git a/Makefile b/Makefile index 1073b90..3031bb4 100644 --- a/Makefile +++ b/Makefile @@ -31,17 +31,11 @@ clean-venv: test: install uv run --locked python -m unittest discover tests -.PHONY: build -build: install - @# Slightly disgusting; just installing the `build` module into the working venv and - @# removing after we're done. - uv pip install build - uv run python -m build - uv pip uninstall build - .PHONY: test_wheel -test_wheel: clean build - @# Build the wheel, then install it and check that we can import it. +test_wheel: clean + @# Build the wheel + uv build + @# Now install it in an isolated directory and check that we can import it. rm -rf testdir && mkdir testdir cd testdir && uv venv cd testdir && uv pip install `find ../dist/ -name *.whl`