Skip to content

Commit df5970a

Browse files
Now using uv as it supports installing deps without the current project
1 parent 3d0368e commit df5970a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ jobs:
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Release
37-
uses: patrick-kidger/action_update_python_project@v1
37+
uses: patrick-kidger/action_update_python_project@v7
3838
with:
3939
python-version: "3.11"
4040
test-script: |
41-
python -m pip install pytest
4241
cp -r ${{ github.workspace }}/test ./test
43-
pytest
42+
cp ${{ github.workspace }}/pyproject.toml ./pyproject.toml
43+
uv sync --extra dev --no-install-project --inexact
44+
uv run --no-sync pytest
4445
pypi-token: ${{ secrets.pypi_token }}
4546
github-user: your-username-here
4647
github-token: ${{ github.token }} # automatically created token
@@ -61,9 +62,10 @@ The following are options for passing to `with`:
6162

6263
Notes on `test-script`:
6364

64-
- Note that it runs in a temporary directory. Thus you will need to copy your tests over as in the example above. This is to avoid spuriously passing tests: it can happen that files have been incorrectly left out of the sdist/wheel, but are still available through the repository itself.
65+
- It runs in a temporary directory. Thus you will need to copy your tests over as in the example above. This is to avoid spuriously passing tests: it can happen that files have been incorrectly left out of the sdist/wheel, but are still available through the repository itself.
6566
- Any `"` characters must be escaped as `\"`.
6667
- The exit code of this script is used to determine whether the tests count as having passed or not. `0` is a pass; everything else is a failure.
68+
- The code from your library will have been installed into a fresh virtual environment at `./.venv` using `uv pip install`. The `uv sync` command in the example above is the appropriate invocation to install the `dev` extras from copied `pyproject.toml`, *without* also overwriting the existing install, and *without* removing the existing install.
6769

6870
### FAQ
6971

action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ runs:
3838
shell: bash
3939
run: |
4040
python -m pip install --upgrade pip
41-
python -m pip install build
41+
python -m pip install build uv
4242
python -m build
4343
4444
- name: Get versions
@@ -75,8 +75,9 @@ runs:
7575
if: steps.get-versions.outputs.new-version == 'true'
7676
shell: bash
7777
run: |
78-
python -m pip install dist/*.tar.gz
7978
cd $(mktemp -d)
79+
python -m uv venv
80+
python -m uv pip install ${{ github.workspace }}/dist/*.tar.gz --target .venv/lib/*/site-packages/
8081
set +e
8182
bash -c "
8283
${{ inputs.test-script }}
@@ -88,16 +89,16 @@ runs:
8889
echo result=false >> $GITHUB_OUTPUT
8990
fi
9091
set -e
91-
python -m pip uninstall -y -r <(pip freeze)
9292
cd ${{ github.workspace }}
9393
9494
- name: Test bdist_wheel
9595
id: test-bdist-wheel
9696
if: steps.get-versions.outputs.new-version == 'true'
9797
shell: bash
9898
run: |
99-
python -m pip install dist/*.whl
10099
cd $(mktemp -d)
100+
python -m uv venv
101+
python -m uv pip install ${{ github.workspace }}/dist/*.whl --target .venv/lib/*/site-packages/
101102
set +e
102103
bash -c "
103104
${{ inputs.test-script }}
@@ -109,7 +110,6 @@ runs:
109110
echo result=false >> $GITHUB_OUTPUT
110111
fi
111112
set -e
112-
python -m pip uninstall -y -r <(pip freeze)
113113
cd ${{ github.workspace }}
114114
115115
- name: Logging

0 commit comments

Comments
 (0)