Skip to content

Commit

Permalink
Use uv over pip
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat committed Sep 17, 2024
1 parent 35d8269 commit 53e5592
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 71 deletions.
59 changes: 30 additions & 29 deletions .github/workflows/check.yml → .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,21 @@ jobs:
done
exit 1
shell: bash
- name: Setup python for tox
uses: actions/setup-python@v5
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add .local/bin to Windows PATH
if: runner.os == 'Windows'
shell: bash
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup brew python for test ${{ matrix.py }}
if: startsWith(matrix.py,'brew@')
run: |
Expand All @@ -74,23 +85,9 @@ jobs:
brew cleanup && brew upgrade python@$PY || brew install python@$PY
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
shell: bash
- name: Install tox-uv
run: python -m pip install tox-uv pip -U
if: "!(startsWith(matrix.py,'pypy') || matrix.py == '3.7' || matrix.py == '[email protected]' || matrix.py == '[email protected]')"
- name: Install tox
run: python -m pip install tox pip -U
if: "(startsWith(matrix.py,'pypy') || matrix.py == '3.7' || matrix.py == '[email protected]' || matrix.py == '[email protected]')"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use local virtualenv for tox
run: python -m pip install .
- name: Setup python for test ${{ matrix.py }}
if: "!( startsWith(matrix.py,'brew@') || endsWith(matrix.py, '-dev') )"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
allow-prereleases: true
run: uv python install --python-preference only-managed ${{ matrix.py }}
- name: Pick environment to run
run: |
import os; import platform; import sys; from pathlib import Path
Expand All @@ -102,9 +99,9 @@ jobs:
file_handler.write(env)
shell: python
- name: Setup test suite
run: tox -vv --notest --skip-missing-interpreters false
run: tox run -vv --notest --skip-missing-interpreters false
- name: Run test suite
run: tox --skip-pkg-install
run: tox run --skip-pkg-install
timeout-minutes: 20
env:
PYTEST_ADDOPTS: "-vv --durations=20"
Expand Down Expand Up @@ -134,15 +131,19 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python "3.12"
uses: actions/setup-python@v5
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add .local/bin to Windows PATH
if: runner.os == 'Windows'
shell: bash
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
- name: Install tox
run: python -m pip install tox-uv
- name: Setup check
run: python -m tox --skip-missing-interpreters false -e ${{ matrix.tox_env }} --notest
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup check suite
run: tox r -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
- name: Run check for ${{ matrix.tox_env }}
run: python -m tox --skip-pkg-install -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: "yes"
run: tox r --skip-pkg-install -e ${{ matrix.tox_env }}
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release to PyPI
on:
push:
tags: ["*"]

env:
dists-artifact-name: python-package-distributions

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: ${{ env.dists-artifact-name }}
path: dist/*

release:
needs:
- build
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/virtualenv/${{ github.ref_name }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: ${{ env.dists-artifact-name }}
path: dist/
- name: Publish to PyPI
uses: pypa/[email protected]
with:
attestations: true
27 changes: 0 additions & 27 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Discord](https://img.shields.io/discord/803025117553754132)](https://discord.gg/pypa)
[![Downloads](https://static.pepy.tech/badge/virtualenv/month)](https://pepy.tech/project/virtualenv)
[![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT)
[![check](https://github.com/pypa/virtualenv/actions/workflows/check.yml/badge.svg)](https://github.com/pypa/virtualenv/actions/workflows/check.yml)
[![check](https://github.com/pypa/virtualenv/actions/workflows/check.yaml/badge.svg)](https://github.com/pypa/virtualenv/actions/workflows/check.yaml)

A tool for creating isolated `virtual` python environments.

Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2765.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade embedded wheels: setuptools to ``75.1.0`` from ``74.1.2`` - by :user:`gaborbernat`.
14 changes: 7 additions & 7 deletions src/virtualenv/seed/wheels/embed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@
},
"3.8": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.9": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.10": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.11": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.12": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.13": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
"3.14": {
"pip": "pip-24.2-py3-none-any.whl",
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
"wheel": "wheel-0.44.0-py3-none-any.whl",
},
}
Expand Down
Binary file not shown.
15 changes: 8 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,21 @@ uv_seed = true
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
skip_install = true
deps =
pre-commit-uv>=4.1
pre-commit-uv>=4.1.1
commands =
pre-commit run --all-files --show-diff-on-failure

[testenv:readme]
description = check that the long description is valid (need for PyPI)
description = check that the long description is valid
skip_install = true
deps =
build[uv]>=1.2.2
check-wheel-contents>=0.6
twine>=5.1.1
extras =
uv>=0.4.10
commands =
python -m build -o {envtmpdir} --installer uv --wheel --sdist .
twine check {envtmpdir}/*
uv build --sdist --wheel --out-dir {envtmpdir} .
twine check {envtmpdir}{/}*
check-wheel-contents --no-config {envtmpdir}

[testenv:docs]
description = build documentation
Expand All @@ -71,7 +72,7 @@ commands =
description = upgrade pip/wheels/setuptools to latest
skip_install = true
deps =
ruff>=0.6.4
ruff>=0.6.5
pass_env =
UPGRADE_ADVISORY
change_dir = {toxinidir}/tasks
Expand Down

0 comments on commit 53e5592

Please sign in to comment.