Skip to content

Commit 4215005

Browse files
authored
Add tox-uv support (#9)
1 parent 0819bf1 commit 4215005

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

.github/workflows/lint.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
pre-commit:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v3
14-
- uses: pre-commit/[email protected].0
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
- uses: pre-commit/[email protected].1

.github/workflows/test.yaml

+16-6
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,38 @@ on:
1212

1313
jobs:
1414
test:
15-
name: ${{ matrix.platform }} py${{ matrix.python-version }}
15+
name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{ matrix.runner }}
1616
runs-on: ${{ matrix.platform }}
1717
strategy:
1818
matrix:
1919
platform: [ubuntu-latest]
20-
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
20+
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
21+
runner: [virtualenv, uv-venv-runner]
22+
exclude:
23+
- python-version: 3.7
24+
runner: uv-venv-runner
25+
26+
2127

2228
steps:
23-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
2430

2531
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
2733
with:
2834
python-version: ${{ matrix.python-version }}
2935

3036
- name: Install dependencies
3137
run: |
3238
python -m pip install --upgrade pip
3339
python -m pip install setuptools tox tox-gh-actions
40+
- name: Install tox-uv
41+
if: matrix.runner == 'uv-venv-runner' && matrix.python-version != '3.7'
42+
run: |
43+
python -m pip install tox-uv
3444
# this runs the platform-specific tests declared in tox.ini
3545
- name: Test with tox
36-
run: python -m tox
46+
run: python -m tox run --runner ${{ matrix.runner }}
3747

3848
- name: Coverage
3949
uses: codecov/codecov-action@v3
@@ -53,11 +63,11 @@ jobs:
5363
uses: actions/setup-python@v4
5464
with:
5565
python-version: |
56-
3.7
5766
3.8
5867
3.9
5968
3.10
6069
3.11
70+
3.12
6171
6272
- name: Install dependencies
6373
run: |

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Tests](https://github.com/Czaki/tox-min-req/actions/workflows/test.yaml/badge.svg)](https://github.com/Czaki/tox-min-req/actions/workflows/test.yaml)
88
[![PyPI - License](https://img.shields.io/pypi/l/tox-min-req.svg)](https://pypi.org/project/tox-min-req)
99
[![codecov](https://codecov.io/gh/Czaki/tox-min-req/branch/main/graph/badge.svg?token=QrHmd50nYq)](https://codecov.io/gh/Czaki/tox-min-req)
10+
[![Downloads](https://static.pepy.tech/badge/tox-min-req/month)](https://pepy.tech/project/tox-min-req)
1011
-----
1112

1213
**Table of Contents**
@@ -31,7 +32,7 @@ One alternative solution is to use the `deps` section in tox configuration to in
3132
However, packages from `deps` and the actual package to be tested are installed in two independent steps. This means that
3233
some of the min-req dependencies could be upgraded or downgraded when installing the actual package.
3334

34-
The `PIP_CONSTRAINT` variable is used to pin the dependencies; it will apply to the call of `pip install`
35+
The `PIP_CONSTRAINT` and `UV_CONSTRAINT` variables are used to pin the dependencies; it will apply to the call of `pip install`
3536
during dependency resolving.
3637

3738

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.9",
2525
"Programming Language :: Python :: 3.10",
2626
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
2728
"Programming Language :: Python :: Implementation :: CPython",
2829
"License :: OSI Approved :: MIT License",
2930
"Operating System :: OS Independent",

tox_min_req/_tox_plugin.py

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def _write_constrains_file(tox_env: "ToxEnv", dependencies: Dict[str, str], extr
3535
else:
3636
tox_env.environment_variables["PIP_CONSTRAINT"] = str(constrain_file)
3737

38+
if tox_env.environment_variables.get("UV_CONSTRAINT", ""):
39+
tox_env.environment_variables["UV_CONSTRAINT"] += f" {str(constrain_file)}"
40+
else:
41+
tox_env.environment_variables["UV_CONSTRAINT"] = str(constrain_file)
42+
3843
return constrain_file
3944

4045

0 commit comments

Comments
 (0)