Skip to content

Commit a558e66

Browse files
committed
Modernize tox config and switch to tox-gh
1 parent 2deb584 commit a558e66

File tree

3 files changed

+63
-64
lines changed

3 files changed

+63
-64
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,31 @@ on:
99
permissions: {}
1010

1111
jobs:
12-
build:
13-
12+
test:
13+
name: test with ${{ matrix.env }} on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
1415
strategy:
16+
fail-fast: false
1517
matrix:
16-
platform: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
17-
python-version: [3.9, "3.10", 3.11, 3.12, 3.13]
18-
19-
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
20-
runs-on: ${{ matrix.platform }}
21-
18+
env: [3.9, "3.10", 3.11, 3.12, 3.13]
19+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
2220
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v4
21+
- uses: actions/checkout@v4
2522
with:
2623
submodules: true
2724
persist-credentials: false
28-
29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v5
31-
with:
32-
python-version: ${{ matrix.python-version }}
33-
34-
- name: Install dependencies
35-
run: |
36-
python -m pip install --upgrade pip
37-
pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2
38-
pip install setuptools tox tox-gh-actions
39-
40-
- name: Test with tox
41-
run: tox
25+
- name: Install the latest version of uv
26+
uses: astral-sh/setup-uv@v3
27+
- name: Install tox
28+
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv --with tox-gh
29+
- name: Install Python
30+
if: matrix.env != '3.13'
31+
run: uv python install --python-preference only-managed ${{ matrix.env }}
32+
- name: Setup test suite
33+
run: tox run -vv --notest --skip-missing-interpreters false
34+
env:
35+
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
36+
- name: Run test suite
37+
run: tox run --skip-pkg-install
38+
env:
39+
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}

pyproject.toml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ classifiers = [
3636
dev = [
3737
"pytest>=8.3.5",
3838
"pytest-httpserver>=1.0.10",
39-
"types-requests>=2.32.0.20250328",
4039
]
4140
lint = [
4241
"black>=25.1.0",
4342
"flake8>=7.2.0",
4443
"mypy>=1.15.0",
4544
"pylint>=3.3.6",
4645
"ruff>=0.11.6",
46+
"types-requests>=2.32.0.20250328",
4747
]
4848

4949
[project.urls]
@@ -96,3 +96,43 @@ ignorelist = ["id"]
9696

9797
[tool.setuptools.package-data]
9898
minfraud = ["py.typed"]
99+
100+
[tool.tox]
101+
env_list = [
102+
"3.9",
103+
"3.10",
104+
"3.11",
105+
"3.12",
106+
"3.13",
107+
"lint",
108+
]
109+
skip_missing_interpreters = false
110+
111+
[tool.tox.env_run_base]
112+
dependency_groups = [
113+
"dev",
114+
]
115+
commands = [
116+
["pytest", "tests"],
117+
]
118+
119+
[tool.tox.env.lint]
120+
description = "Check code formatting with Black on Python 3.13"
121+
python = "3.13"
122+
dependency_groups = [
123+
"dev",
124+
"lint",
125+
]
126+
commands = [
127+
["black", "--check", "--diff", "."],
128+
["flake8", "minfraud"],
129+
["mypy", "minfraud", "tests"],
130+
["pylint", "minfraud"],
131+
]
132+
133+
[tool.tox.gh.python]
134+
"3.13" = ["3.13", "lint"]
135+
"3.12" = ["3.12"]
136+
"3.11" = ["3.11"]
137+
"3.10" = ["3.10"]
138+
"3.9" = ["3.9"]

setup.cfg

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
11
[flake8]
22
# black uses 88 : ¯\_(ツ)_/¯
33
max-line-length = 88
4-
5-
[tox:tox]
6-
envlist = {py39,py310,py311,py313}-test,py313-{black,lint,flake8,mypy}
7-
8-
[gh-actions]
9-
python =
10-
3.9: py39
11-
3.10: py310
12-
3.11: py311
13-
3.12: py312
14-
3.13: py313,black,lint,flake8,mypy
15-
16-
[testenv:{py38,py39,py310,py311,py312,py313}-test]
17-
deps =
18-
pytest-httpserver
19-
pytest
20-
21-
commands = pytest tests
22-
23-
[testenv:py313-black]
24-
deps = black
25-
commands = black --check --diff .
26-
27-
[testenv:py313-lint]
28-
deps = pylint
29-
commands = pylint minfraud
30-
31-
[testenv:py313-flake8]
32-
deps = flake8
33-
commands = flake8 minfraud
34-
35-
[testenv:py313-mypy]
36-
deps =
37-
mypy
38-
pytest_httpserver
39-
pytest
40-
types-requests
41-
voluptuous-stubs
42-
commands = mypy minfraud tests

0 commit comments

Comments
 (0)