Skip to content

Commit e68deeb

Browse files
authored
Merge pull request #204 from maxmind/greg/eng-1823
Update tox config and move to tox-gh
2 parents bb299be + 8d1c934 commit e68deeb

File tree

3 files changed

+75
-76
lines changed

3 files changed

+75
-76
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: 53 additions & 9 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",
@@ -49,6 +50,20 @@ requires = [
4950
]
5051
build-backend = "setuptools.build_meta"
5152

53+
[project.urls]
54+
Homepage = "https://www.maxmind.com/"
55+
Documentation = "https://geoip2.readthedocs.org/"
56+
"Source Code" = "https://github.com/maxmind/GeoIP2-python"
57+
"Issue Tracker" = "https://github.com/maxmind/GeoIP2-python/issues"
58+
59+
[tool.black]
60+
# src is showing up in our GitHub linting builds. It seems to
61+
# contain deps.
62+
extend-exclude = '^/src/'
63+
64+
[tool.pylint."MESSAGES CONTROL"]
65+
disable = "duplicate-code"
66+
5267
[tool.ruff.lint]
5368
select = ["ALL"]
5469
ignore = [
@@ -79,13 +94,42 @@ ignore = [
7994
[tool.setuptools.package-data]
8095
geoip2 = ["py.typed"]
8196

82-
[project.urls]
83-
Homepage = "https://www.maxmind.com/"
84-
Documentation = "https://geoip2.readthedocs.org/"
85-
"Source Code" = "https://github.com/maxmind/GeoIP2-python"
86-
"Issue Tracker" = "https://github.com/maxmind/GeoIP2-python/issues"
97+
[tool.tox]
98+
env_list = [
99+
"3.9",
100+
"3.10",
101+
"3.11",
102+
"3.12",
103+
"3.13",
104+
"lint",
105+
]
106+
skip_missing_interpreters = false
87107

88-
[tool.black]
89-
# src is showing up in our GitHub linting builds. It seems to
90-
# contain deps.
91-
extend-exclude = '^/src/'
108+
[tool.tox.env_run_base]
109+
dependency_groups = [
110+
"dev",
111+
]
112+
commands = [
113+
["pytest", "tests"],
114+
]
115+
116+
[tool.tox.env.lint]
117+
description = "Code linting"
118+
python = "3.13"
119+
dependency_groups = [
120+
"dev",
121+
"lint",
122+
]
123+
commands = [
124+
["black", "--check", "--diff", "."],
125+
["flake8", "geoip2"],
126+
["mypy", "geoip2", "tests"],
127+
["pylint", "geoip2"],
128+
]
129+
130+
[tool.tox.gh.python]
131+
"3.13" = ["3.13", "lint"]
132+
"3.12" = ["3.12"]
133+
"3.11" = ["3.11"]
134+
"3.10" = ["3.10"]
135+
"3.9" = ["3.9"]

setup.cfg

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
11
[flake8]
22
# black uses 88 : ¯\_(ツ)_/¯
33
max-line-length = 88
4-
5-
[options.package_data]
6-
geoip2 = py.typed
7-
8-
[pylint.message_control]
9-
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)