Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use uv build #61

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python: [39, 310, 311, 312]
tpgillam marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v4

- 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 }}
Expand All @@ -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

Expand All @@ -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
tpgillam marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions/upload-artifact@v4
with:
Expand All @@ -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:
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down