Skip to content

Commit 120a6ce

Browse files
committed
build(tox): initial support
1 parent 636d967 commit 120a6ce

File tree

6 files changed

+87
-17
lines changed

6 files changed

+87
-17
lines changed

.github/workflows/testing.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
name: Lint
32

4-
name: Build, Lint and Test
5-
6-
on:
7-
push:
8-
branches: [ "master" ]
9-
pull_request:
10-
branches: [ "master" ]
3+
on: [push, pull_request]
114

125
permissions:
136
contents: read
@@ -17,10 +10,12 @@ jobs:
1710
runs-on: ubuntu-latest
1811
steps:
1912
- uses: actions/checkout@v3
20-
- name: Set up Python 3.8
13+
14+
- name: Set up Python 3.12
2115
uses: actions/setup-python@v3
2216
with:
23-
python-version: "3.8"
17+
python-version: "3.12"
18+
2419
- name: Install dependencies
2520
run: |
2621
python -m pip install --upgrade pip
@@ -30,6 +25,3 @@ jobs:
3025
pre-commit run --all-files
3126
- name: Run Ruff
3227
run: ruff check --output-format=github .
33-
- name: Test with pytest
34-
run: |
35-
pytest

.github/workflows/tox.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Run Tests with Tox
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install tox
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r dev-requirements.txt
28+
29+
- name: Run tox
30+
run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: python3.8
2+
python: python3.12
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v4.5.0

dev-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pytest-cov==5.0.0
44
pytest==8.3.5
55
ruff==0.1.15
66
packaging==23.0
7+
tox==3.28.0

setup.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# encoding: utf-8
2-
from setuptools import setup
2+
try:
3+
from setuptools import setup
4+
except ImportError:
5+
# For Python 3.12+, setuptools is no longer in stdlib
6+
import sys
7+
print("Error: setuptools is required but not found.")
8+
print("Please install setuptools package using:")
9+
print("pip install setuptools")
10+
sys.exit(1)
311

412

513
def get_description():
@@ -21,11 +29,17 @@ def get_description():
2129
zip_safe=False,
2230
platforms='any',
2331
install_requires=['Flask>=0.11'],
32+
python_requires='>=3.6',
2433
classifiers=[
2534
'Environment :: Web Environment',
2635
'Intended Audience :: Developers',
2736
'Operating System :: OS Independent',
28-
'Programming Language :: Python',
37+
'Programming Language :: Python :: 3',
38+
'Programming Language :: Python :: 3.8',
39+
'Programming Language :: Python :: 3.9',
40+
'Programming Language :: Python :: 3.10',
41+
'Programming Language :: Python :: 3.11',
42+
'Programming Language :: Python :: 3.12',
2943
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3044
'Topic :: Software Development :: Libraries :: Python Modules'
3145
]

tox.ini

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[tox]
2+
envlist = py38, py39, py310, py311, py312
3+
4+
[testenv]
5+
deps =
6+
-r dev-requirements.txt
7+
commands = pytest
8+
9+
[testenv:py38]
10+
deps =
11+
{[testenv]deps}
12+
# Python 3.8 specific dependencies here
13+
14+
[testenv:py39]
15+
deps =
16+
{[testenv]deps}
17+
# Python 3.9 specific dependencies here
18+
19+
[testenv:py310]
20+
deps =
21+
{[testenv]deps}
22+
# Python 3.10 specific dependencies here
23+
24+
[testenv:py311]
25+
deps =
26+
{[testenv]deps}
27+
# Python 3.11 specific dependencies here
28+
29+
[testenv:py312]
30+
deps =
31+
{[testenv]deps}
32+
setuptools>=42.0.0
33+
# Other Python 3.12 specific dependencies here

0 commit comments

Comments
 (0)