Skip to content

Commit

Permalink
Use uv to install our tools (#86)
Browse files Browse the repository at this point in the history
* Use uv to install our tools

* Create venv too

* Be explicit

* Fix path

* Set venv explicitly

* TIL pipx is preinstalled

* Try caching

Co-authored-by: Co-authored-by: Hugo van Kemenade <[email protected]>

* Add changelog

* Benchmark installation methods

* Install uv using curl

It's much faster: 0m3.533s vs 0m1.864s

---------

Co-authored-by: Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
hynek and hugovk authored Mar 24, 2024
1 parent 42f0c91 commit 948f969
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
[#98](https://github.com/hynek/build-and-inspect-python-package/pull/98)


### Changed

- The action now uses [*uv*](https://github.com/astral-sh/uv) to install its tools to speed up your CI runs.
[#86](https://github.com/hynek/build-and-inspect-python-package/pull/86)


## [2.0.2](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.1...v2.0.2) – 2024-03-16

### Changed
Expand Down
28 changes: 22 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,34 @@ runs:
python-version: "3.x"
update-environment: false

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
shell: bash

- name: Find uv cache
run: echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV
shell: bash

- name: Cache uv
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE }}
key: ${{ runner.os }}-uv

- name: Create venv for tools
run: ${{ steps.python-baipp.outputs.python-path }} -Im venv /tmp/baipp
run: >
uv venv
/tmp/baipp
--python ${{ steps.python-baipp.outputs.python-path }}
shell: bash

- name: Install our tools
run: >
/tmp/baipp/bin/python
-Im pip
--disable-pip-version-check
--no-python-version-warning
install -r ${{ github.action_path }}/requirements/tools.txt
uv pip sync
${{ github.action_path }}/requirements/tools.txt
shell: bash
env:
VIRTUAL_ENV: /tmp/baipp

# Build SDist, then build wheel out of it if the user didn't forbid it.
# Set 'SOURCE_DATE_EPOCH' based on the last commit for build
Expand Down

0 comments on commit 948f969

Please sign in to comment.