Skip to content

Commit

Permalink
Use uv for virtualenv and pip when available (#192)
Browse files Browse the repository at this point in the history
* Update docs to list 3.8 as minimum version

* Prefer using uv for venv+pip when available

* Use cached uv action from hynek

* Create and source venv first

* Always use bash in GHA

* Move deck chairs of venv creation

* Source before every step

* Flag to let uv install to system

* UV system python flag

* Test on 3.13
  • Loading branch information
amyreese authored Sep 1, 2024
1 parent ad505f3 commit 37b44c2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macOS-latest, ubuntu-latest, windows-latest]

env:
UV_SYSTEM_PYTHON: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: hynek/setup-cached-uv@v2
with:
cache-dependency-path: pyproject.toml
- name: Install
run: |
python -m pip install --upgrade pip
make EXTRAS=dev install
run: make EXTRAS=dev install
- name: Test
run: make test
- name: Lint
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Preparation

You'll need to have Python 3.6 available for testing.
You'll need to have Python 3.8 or newer available for testing.
I recommend using [pyenv][] for this:

$ pyenv install 3.6.5
$ pyenv shell 3.6.5
$ pyenv install 3.12
$ pyenv shell 3.12


## Setup
Expand All @@ -28,6 +28,6 @@ that you have done the following:
* Added appropriate license headers to new files
* Written or modified tests for new functionality
* Used `make format` to format code appropriately
* Validated and tested code with `make lint test`
* Validated and tested code with `make test lint`

[pyenv]: https://github.com/pyenv/pyenv
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Implementation of itertools, builtins, and more for AsyncIO and mixed-type itera
Install
-------

aioitertools requires Python 3.6 or newer.
aioitertools requires Python 3.8 or newer.
You can install it from PyPI:

$ pip install aioitertools
Expand Down
17 changes: 13 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
PKG:=aioitertools
EXTRAS:=dev,docs

UV_VERSION:=$(shell uv --version)
ifdef UV_VERSION
VENV:=uv venv
PIP:=uv pip
else
VENV:=python -m venv
PIP:=python -m pip
endif

.venv:
python -m venv .venv
source .venv/bin/activate && make install
echo 'run `source .venv/bin/activate` to use virtualenv'
$(VENV) .venv

venv: .venv
source .venv/bin/activate && make install
echo 'run `source .venv/bin/activate` to use virtualenv'

install:
python -m pip install -Ue .[$(EXTRAS)]
$(PIP) install -Ue .[$(EXTRAS)]

release: lint test clean
flit publish
Expand Down

0 comments on commit 37b44c2

Please sign in to comment.