Skip to content

Commit 6211597

Browse files
committed
Modernize tox config and switch to tox-gh
1 parent b5be922 commit 6211597

File tree

3 files changed

+63
-61
lines changed

3 files changed

+63
-61
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +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 setuptools tox tox-gh-actions
38-
39-
- name: Test with tox
40-
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ dev = [
3737
]
3838
lint = [
3939
"black>=25.1.0",
40+
"flake8>=7.2.0",
4041
"mypy>=1.15.0",
4142
"pylint>=3.3.6",
4243
"ruff>=0.11.6",
@@ -89,3 +90,43 @@ ignore = [
8990

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

setup.cfg

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,3 @@ geoip2 = py.typed
77

88
[pylint.message_control]
99
disable = duplicate-code
10-
11-
[tox:tox]
12-
envlist = {py39,py310,py311,py312,py313}-test,py313-{black,lint,flake8,mypy}
13-
14-
[gh-actions]
15-
python =
16-
3.9: py39
17-
3.10: py310
18-
3.11: py311
19-
3.12: py312
20-
3.13: py313,black,lint,flake8,mypy
21-
22-
[testenv:{py38,py39,py310,py311,py312,py313}-test]
23-
deps =
24-
pytest-httpserver
25-
pytest
26-
commands = pytest tests
27-
28-
[testenv:py313-black]
29-
deps = black
30-
commands = black --check --diff .
31-
32-
[testenv:py313-lint]
33-
deps = pylint
34-
commands = pylint geoip2
35-
36-
[testenv:py313-flake8]
37-
deps = flake8
38-
commands = flake8 geoip2
39-
40-
[testenv:py313-mypy]
41-
deps =
42-
mypy
43-
pytest_httpserver
44-
pytest
45-
types-requests
46-
voluptuous-stubs
47-
commands = mypy geoip2 tests

0 commit comments

Comments
 (0)