Skip to content

Commit dc051a9

Browse files
committed
build(tox): initial support
1 parent aad7c13 commit dc051a9

File tree

7 files changed

+99
-20
lines changed

7 files changed

+99
-20
lines changed

.github/workflows/testing.yml

+6-14
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

+30
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

.pre-commit-config.yaml

+1-1
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

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Tests
110110

111111
To run Flask-Stupe tests:
112112

113-
* install developers requirements with ``pip install -r requirements.txt``;
113+
* install developers requirements with ``pip install -r dev-requirements.txt``;
114114
* run ``pytest``.
115115

116116

dev-requirements.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
-r requirements.txt
2+
packaging==23.0
23
pre-commit==3.5.0
34
pytest-cov==5.0.0
45
pytest==8.3.5
56
ruff==0.1.15
6-
packaging==23.0
7+
tox-gh-actions==3.3.0
8+
tox==4.4.12

setup.py

+16-3
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():
@@ -20,12 +28,17 @@ def get_description():
2028
include_package_data=True,
2129
zip_safe=False,
2230
platforms='any',
23-
install_requires=['Flask>=0.11'],
31+
python_requires='>=3.8',
2432
classifiers=[
2533
'Environment :: Web Environment',
2634
'Intended Audience :: Developers',
2735
'Operating System :: OS Independent',
28-
'Programming Language :: Python',
36+
'Programming Language :: Python :: 3',
37+
'Programming Language :: Python :: 3.8',
38+
'Programming Language :: Python :: 3.9',
39+
'Programming Language :: Python :: 3.10',
40+
'Programming Language :: Python :: 3.11',
41+
'Programming Language :: Python :: 3.12',
2942
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3043
'Topic :: Software Development :: Libraries :: Python Modules'
3144
]

tox.ini

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

0 commit comments

Comments
 (0)