Skip to content

Commit 4c758e5

Browse files
committed
fix: update the tox settings
1 parent bf6363d commit 4c758e5

File tree

6 files changed

+186
-75
lines changed

6 files changed

+186
-75
lines changed

.coverage

52 KB
Binary file not shown.

.github/workflows/pythonpackage.yml

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,68 @@ jobs:
3030
os: macos-latest
3131

3232
steps:
33-
- uses: actions/checkout@v4.1.7
33+
- uses: actions/checkout@v4
3434
- name: Set up Python ${{ matrix.python-version }}
3535
uses: actions/[email protected]
3636
with:
3737
python-version: ${{ matrix.python-version }}
3838
allow-prereleases: true
39-
- name: Install dependencies
40-
run: |
41-
python -m pip install --upgrade pip
42-
pip install --upgrade -r requirements-dev.txt
43-
pip install .
44-
- name: Test with pytest
45-
run: |
46-
pytest --cov --junitxml=junit.xml
47-
- name: Upload coverage to Codecov
48-
uses: codecov/codecov-action@v4
39+
- name: install uv
40+
uses: astral-sh/setup-uv@v3
4941
with:
50-
token: ${{ secrets.CODECOV_TOKEN }}
51-
- name: Upload test results to Codecov
52-
if: ${{ !cancelled() }}
53-
uses: codecov/test-results-action@v1
42+
enable-cache: true
43+
cache-dependency-glob: requirements-dev.txt
44+
45+
- name: Install dependencies
46+
run: uv pip install --system tox tox-uv
47+
48+
- name: Run tox targets for ${{ matrix.python-version }}
49+
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
50+
51+
- name: Upload coverage data
52+
uses: actions/upload-artifact@v4
5453
with:
55-
token: ${{ secrets.CODECOV_TOKEN }}
54+
name: coverage-data-${{ matrix.python-version }}
55+
path: '${{ github.workspace }}/.coverage.*'
56+
include-hidden-files: true
57+
if-no-files-found: error
58+
59+
60+
coverage:
61+
name: Coverage
62+
runs-on: ubuntu-24.04
63+
needs: build
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: actions/setup-python@v5
68+
with:
69+
python-version: '3.12'
70+
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@v3
73+
74+
- name: Install dependencies
75+
run: uv pip install --system coverage[toml]
76+
77+
- name: Download data
78+
uses: actions/download-artifact@v4
79+
with:
80+
path: ${{ github.workspace }}
81+
pattern: coverage-data-*
82+
merge-multiple: true
83+
84+
- name: Combine coverage and fail if it's <100%
85+
run: |
86+
python -m coverage combine
87+
python -m coverage html --skip-covered --skip-empty
88+
python -m coverage report --fail-under=90
89+
echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY
90+
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
91+
92+
- name: Upload HTML report
93+
if: ${{ failure() }}
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: html-report
97+
path: htmlcov

.pre-commit-config.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
ci:
2+
autofix_commit_msg: |
3+
ci: auto fixes from pre-commit hooks
4+
5+
for more information, see https://pre-commit.ci
6+
autofix_prs: true
7+
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
8+
autoupdate_schedule: monthly
9+
10+
default_language_version:
11+
python: python3.12
12+
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v5.0.0
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-case-conflict
19+
- id: check-json
20+
- id: check-merge-conflict
21+
- id: check-symlinks
22+
- id: check-toml
23+
- id: end-of-file-fixer
24+
- id: trailing-whitespace
25+
- repo: https://github.com/tox-dev/pyproject-fmt
26+
rev: v2.5.0
27+
hooks:
28+
- id: pyproject-fmt
29+
- repo: https://github.com/tox-dev/tox-ini-fmt
30+
rev: 1.4.1
31+
hooks:
32+
- id: tox-ini-fmt
33+
- repo: https://github.com/rstcheck/rstcheck
34+
rev: v6.2.4
35+
hooks:
36+
- id: rstcheck
37+
additional_dependencies:
38+
- tomli==2.0.1
39+
- repo: https://github.com/asottile/pyupgrade
40+
rev: v3.19.0
41+
hooks:
42+
- id: pyupgrade
43+
args: [--py38-plus]
44+
- repo: https://github.com/psf/black-pre-commit-mirror
45+
rev: 24.10.0
46+
hooks:
47+
- id: black
48+
- repo: https://github.com/adamchainz/blacken-docs
49+
rev: 1.19.1
50+
hooks:
51+
- id: blacken-docs
52+
additional_dependencies:
53+
- black==23.1.0
54+
- repo: https://github.com/pycqa/isort
55+
rev: 5.13.2
56+
hooks:
57+
- id: isort
58+
name: isort (python)
59+
- repo: https://github.com/pre-commit/mirrors-mypy
60+
rev: v1.13.0
61+
hooks:
62+
- id: mypy
63+
additional_dependencies:
64+
- django-stubs==5.0.4

pyproject.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "json2xml"
7+
version = "5.0.5" # Replace with the dynamic version if needed
8+
description = "Simple Python Library to convert JSON to XML"
9+
readme = "README.rst"
10+
requires-python = ">=3.10"
11+
license = { text = "Apache Software License 2.0" }
12+
keywords = ["json2xml"]
13+
authors = [
14+
{ name = "Vinit Kumar", email = "[email protected]" }
15+
]
16+
classifiers = [
17+
"Development Status :: 6 - Mature",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: Apache Software License",
20+
"Natural Language :: English",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: Implementation :: CPython",
26+
"Programming Language :: Python :: Implementation :: PyPy",
27+
"Topic :: Software Development :: Libraries :: Python Modules"
28+
]
29+
dependencies = [
30+
"defusedxml",
31+
"urllib3",
32+
"xmltodict>=0.12.0",
33+
"pytest",
34+
"pytest-cov",
35+
"coverage",
36+
"py",
37+
"setuptools",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://github.com/vinitkumar/json2xml"
42+
43+
[tool.setuptools.packages.find]
44+
include = ["json2xml"]
45+
46+
[project.optional-dependencies]
47+
test = [
48+
"pytest==7.0.1",
49+
"py==1.11.0"
50+
]
51+
52+
[tool.pytest.ini_options]
53+
testpaths = ["tests"]
154
[tool.ruff]
255
exclude = [
356
".env",

setup.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,6 @@
22

33
"""The setup script."""
44

5-
from setuptools import setup, find_packages
6-
from json2xml import __version__
5+
from setuptools import setup
6+
setup()
77

8-
with open("README.rst", encoding="utf-8") as readme_file:
9-
readme = readme_file.read()
10-
11-
with open("HISTORY.rst", encoding="utf-8") as history_file:
12-
history = history_file.read()
13-
14-
with open("requirements.in", encoding="utf-8") as requirements_in:
15-
requirements = [requirements_in.read()]
16-
17-
setup_requirements = []
18-
19-
test_requirements = ["pytest==7.0.1", "py==1.11.0"]
20-
21-
setup(
22-
author="Vinit Kumar",
23-
author_email="[email protected]",
24-
classifiers=[
25-
"Development Status :: 6 - Mature",
26-
"Intended Audience :: Developers",
27-
"License :: OSI Approved :: Apache Software License",
28-
"Natural Language :: English",
29-
"Programming Language :: Python :: 3.10",
30-
"Programming Language :: Python :: 3.11",
31-
"Programming Language :: Python :: 3.12",
32-
"Programming Language :: Python :: 3.13",
33-
"Programming Language :: Python :: Implementation :: CPython",
34-
"Programming Language :: Python :: Implementation :: PyPy",
35-
"Topic :: Software Development :: Libraries :: Python Modules",
36-
],
37-
description="Simple Python Library to convert JSON to XML",
38-
install_requires=requirements,
39-
license="Apache Software License 2.0",
40-
long_description=readme + "\n\n" + history,
41-
long_description_content_type="text/x-rst",
42-
include_package_data=True,
43-
keywords="json2xml",
44-
name="json2xml",
45-
packages=find_packages(include=["json2xml"]),
46-
setup_requires=setup_requirements,
47-
test_suite="tests",
48-
tests_require=test_requirements,
49-
url="https://github.com/vinitkumar/json2xml",
50-
version=__version__,
51-
zip_safe=False,
52-
python_requires=">=3.10",
53-
)

tox.ini

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
[tox]
2-
envlist = py38, py39, py310, py311, py312, pypy38, pypy39
3-
4-
5-
[testenv:flake8]
6-
basepython = python
7-
deps = flake8
8-
commands = flake8 json2xml
2+
envlist = py310, py311, py312, py313, py314, pypy310
93

104
[testenv]
115
setenv =
126
PYTHONPATH = {toxinidir}
137

148
allowlist_externals = pytest
159

16-
commands =
17-
pip install -r requirements-dev.txt
18-
pytest
19-
10+
; pytest
2011

12+
commands =
13+
python \
14+
-W error::ResourceWarning \
15+
-W error::DeprecationWarning \
16+
-W error::PendingDeprecationWarning \
17+
-m coverage run \
18+
-m pytest {posargs:tests}

0 commit comments

Comments
 (0)