Skip to content

Commit 22b9795

Browse files
authored
Use uv over pip (#2765)
1 parent 35d8269 commit 22b9795

File tree

9 files changed

+115
-76
lines changed

9 files changed

+115
-76
lines changed

.github/workflows/check.yml renamed to .github/workflows/check.yaml

+38-34
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,29 @@ jobs:
6262
done
6363
exit 1
6464
shell: bash
65-
- name: Setup python for tox
66-
uses: actions/setup-python@v5
65+
- uses: actions/checkout@v4
66+
with:
67+
fetch-depth: 0
68+
- name: Install the latest version of uv
69+
uses: astral-sh/setup-uv@v3
6770
with:
68-
python-version: "3.12"
71+
enable-cache: true
72+
cache-dependency-glob: "pyproject.toml"
73+
github-token: ${{ secrets.GITHUB_TOKEN }}
74+
- name: Add .local/bin to PATH Windows
75+
if: runner.os == 'Windows'
76+
shell: bash
77+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
78+
- name: Add .local/bin to PATH macos-13
79+
if: matrix.os == 'macos-13'
80+
shell: bash
81+
run: echo ~/.local/bin >> $GITHUB_PATH
82+
- name: Install tox
83+
if: matrix.py == '3.13'
84+
run: uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv
85+
- name: Install tox
86+
if: matrix.py != '3.13'
87+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
6988
- name: Setup brew python for test ${{ matrix.py }}
7089
if: startsWith(matrix.py,'brew@')
7190
run: |
@@ -74,37 +93,18 @@ jobs:
7493
brew cleanup && brew upgrade python@$PY || brew install python@$PY
7594
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
7695
shell: bash
77-
- name: Install tox-uv
78-
run: python -m pip install tox-uv pip -U
79-
if: "!(startsWith(matrix.py,'pypy') || matrix.py == '3.7' || matrix.py == '[email protected]' || matrix.py == '[email protected]')"
80-
- name: Install tox
81-
run: python -m pip install tox pip -U
82-
if: "(startsWith(matrix.py,'pypy') || matrix.py == '3.7' || matrix.py == '[email protected]' || matrix.py == '[email protected]')"
83-
- uses: actions/checkout@v4
84-
with:
85-
fetch-depth: 0
86-
- name: Use local virtualenv for tox
87-
run: python -m pip install .
8896
- name: Setup python for test ${{ matrix.py }}
8997
if: "!( startsWith(matrix.py,'brew@') || endsWith(matrix.py, '-dev') )"
9098
uses: actions/setup-python@v5
9199
with:
92100
python-version: ${{ matrix.py }}
93101
allow-prereleases: true
94102
- name: Pick environment to run
95-
run: |
96-
import os; import platform; import sys; from pathlib import Path
97-
plat = platform.python_implementation()
98-
e = f"3.{sys.version_info.minor}" if plat == "CPython" else f"pypy3{sys.version_info.minor}"
99-
env = f"TOXENV={e}"
100-
print(f"Picked: {env} for {sys.version} based of {sys.executable}")
101-
with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler:
102-
file_handler.write(env)
103-
shell: python
103+
run: python tasks/pick_tox_env.py ${{ matrix.py }}
104104
- name: Setup test suite
105-
run: tox -vv --notest --skip-missing-interpreters false
105+
run: tox run -vv --notest --skip-missing-interpreters false
106106
- name: Run test suite
107-
run: tox --skip-pkg-install
107+
run: tox run --skip-pkg-install
108108
timeout-minutes: 20
109109
env:
110110
PYTEST_ADDOPTS: "-vv --durations=20"
@@ -134,15 +134,19 @@ jobs:
134134
- uses: actions/checkout@v4
135135
with:
136136
fetch-depth: 0
137-
- name: Setup Python "3.12"
138-
uses: actions/setup-python@v5
137+
- name: Install the latest version of uv
138+
uses: astral-sh/setup-uv@v3
139139
with:
140-
python-version: "3.12"
140+
enable-cache: true
141+
cache-dependency-glob: "pyproject.toml"
142+
github-token: ${{ secrets.GITHUB_TOKEN }}
143+
- name: Add .local/bin to Windows PATH
144+
if: runner.os == 'Windows'
145+
shell: bash
146+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
141147
- name: Install tox
142-
run: python -m pip install tox-uv
143-
- name: Setup check
144-
run: python -m tox --skip-missing-interpreters false -e ${{ matrix.tox_env }} --notest
148+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
149+
- name: Setup check suite
150+
run: tox r -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
145151
- name: Run check for ${{ matrix.tox_env }}
146-
run: python -m tox --skip-pkg-install -e ${{ matrix.tox_env }}
147-
env:
148-
UPGRADE_ADVISORY: "yes"
152+
run: tox r --skip-pkg-install -e ${{ matrix.tox_env }}

.github/workflows/release.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release to PyPI
2+
on:
3+
push:
4+
tags: ["*"]
5+
6+
env:
7+
dists-artifact-name: python-package-distributions
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Install the latest version of uv
17+
uses: astral-sh/setup-uv@v3
18+
with:
19+
enable-cache: true
20+
cache-dependency-glob: "pyproject.toml"
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Build package
23+
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: ${{ env.dists-artifact-name }}
28+
path: dist/*
29+
30+
release:
31+
needs:
32+
- build
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: release
36+
url: https://pypi.org/project/virtualenv/${{ github.ref_name }}
37+
permissions:
38+
id-token: write
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: ${{ env.dists-artifact-name }}
44+
path: dist/
45+
- name: Publish to PyPI
46+
uses: pypa/[email protected]
47+
with:
48+
attestations: true

.github/workflows/release.yml

-27
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Discord](https://img.shields.io/discord/803025117553754132)](https://discord.gg/pypa)
88
[![Downloads](https://static.pepy.tech/badge/virtualenv/month)](https://pepy.tech/project/virtualenv)
99
[![PyPI - License](https://img.shields.io/pypi/l/virtualenv?style=flat-square)](https://opensource.org/licenses/MIT)
10-
[![check](https://github.com/pypa/virtualenv/actions/workflows/check.yml/badge.svg)](https://github.com/pypa/virtualenv/actions/workflows/check.yml)
10+
[![check](https://github.com/pypa/virtualenv/actions/workflows/check.yaml/badge.svg)](https://github.com/pypa/virtualenv/actions/workflows/check.yaml)
1111

1212
A tool for creating isolated `virtual` python environments.
1313

docs/changelog/2765.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade embedded wheels: setuptools to ``75.1.0`` from ``74.1.2`` - by :user:`gaborbernat`.

src/virtualenv/seed/wheels/embed/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@
1313
},
1414
"3.8": {
1515
"pip": "pip-24.2-py3-none-any.whl",
16-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
16+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
1717
"wheel": "wheel-0.44.0-py3-none-any.whl",
1818
},
1919
"3.9": {
2020
"pip": "pip-24.2-py3-none-any.whl",
21-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
21+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
2222
"wheel": "wheel-0.44.0-py3-none-any.whl",
2323
},
2424
"3.10": {
2525
"pip": "pip-24.2-py3-none-any.whl",
26-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
26+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
2727
"wheel": "wheel-0.44.0-py3-none-any.whl",
2828
},
2929
"3.11": {
3030
"pip": "pip-24.2-py3-none-any.whl",
31-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
31+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
3232
"wheel": "wheel-0.44.0-py3-none-any.whl",
3333
},
3434
"3.12": {
3535
"pip": "pip-24.2-py3-none-any.whl",
36-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
36+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
3737
"wheel": "wheel-0.44.0-py3-none-any.whl",
3838
},
3939
"3.13": {
4040
"pip": "pip-24.2-py3-none-any.whl",
41-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
41+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
4242
"wheel": "wheel-0.44.0-py3-none-any.whl",
4343
},
4444
"3.14": {
4545
"pip": "pip-24.2-py3-none-any.whl",
46-
"setuptools": "setuptools-74.1.2-py3-none-any.whl",
46+
"setuptools": "setuptools-75.1.0-py3-none-any.whl",
4747
"wheel": "wheel-0.44.0-py3-none-any.whl",
4848
},
4949
}

tasks/pick_tox_env.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from __future__ import annotations
2+
3+
import os
4+
import sys
5+
from pathlib import Path
6+
7+
py = sys.argv[1]
8+
if py.startswith("brew@"):
9+
py = py[len("brew@") :]
10+
env = f"TOXENV={py}"
11+
with Path(os.environ["GITHUB_ENV"]).open("ta", encoding="utf-8") as file_handler:
12+
file_handler.write(env)

tox.ini

+8-7
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,21 @@ uv_seed = true
4444
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
4545
skip_install = true
4646
deps =
47-
pre-commit-uv>=4.1
47+
pre-commit-uv>=4.1.1
4848
commands =
4949
pre-commit run --all-files --show-diff-on-failure
5050

5151
[testenv:readme]
52-
description = check that the long description is valid (need for PyPI)
52+
description = check that the long description is valid
5353
skip_install = true
5454
deps =
55-
build[uv]>=1.2.2
55+
check-wheel-contents>=0.6
5656
twine>=5.1.1
57-
extras =
57+
uv>=0.4.10
5858
commands =
59-
python -m build -o {envtmpdir} --installer uv --wheel --sdist .
60-
twine check {envtmpdir}/*
59+
uv build --sdist --wheel --out-dir {envtmpdir} .
60+
twine check {envtmpdir}{/}*
61+
check-wheel-contents --no-config {envtmpdir}
6162

6263
[testenv:docs]
6364
description = build documentation
@@ -71,7 +72,7 @@ commands =
7172
description = upgrade pip/wheels/setuptools to latest
7273
skip_install = true
7374
deps =
74-
ruff>=0.6.4
75+
ruff>=0.6.5
7576
pass_env =
7677
UPGRADE_ADVISORY
7778
change_dir = {toxinidir}/tasks

0 commit comments

Comments
 (0)