Skip to content

Commit e89aaec

Browse files
committed
fix: crash issues
1 parent 04c1619 commit e89aaec

File tree

7 files changed

+141
-103
lines changed

7 files changed

+141
-103
lines changed

.coverage

0 Bytes
Binary file not shown.

.github/workflows/pythonpackage.yml

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26-
build:
26+
test:
2727
runs-on: ${{ matrix.os }}
2828
strategy:
2929
fail-fast: false
3030
matrix:
3131
python-version: [pypy-3.10, pypy-3.11, '3.10', '3.11', '3.12', '3.13']
32-
tox-python-version: [pypy310, pypy311, py310, py311, py312, py313]
3332
os: [
3433
ubuntu-latest,
3534
windows-latest,
@@ -38,23 +37,13 @@ jobs:
3837
include:
3938
# Add exact version 3.14.0-beta.1 for ubuntu-latest only
4039
- python-version: 3.14.0-beta.1
41-
tox-python-version: py314-full
42-
os: ubuntu-latest
43-
# Add special linting and type-checking jobs
44-
- python-version: '3.12'
45-
tox-python-version: lint
46-
os: ubuntu-latest
47-
- python-version: '3.12'
48-
tox-python-version: typecheck
4940
os: ubuntu-latest
5041
exclude:
5142
# Exclude other OSes with Python 3.14.0-beta.1
5243
- python-version: 3.14.0-beta.1
53-
tox-python-version: py314-full
5444
os: windows-latest
5545
- python-version: 3.14.0-beta.1
5646
os: macos-latest
57-
tox-python-version: py314-full
5847

5948
steps:
6049
- uses: actions/checkout@v4
@@ -71,25 +60,26 @@ jobs:
7160
requirements*.txt
7261
requirements-dev.in
7362
74-
- name: install uv
63+
- name: Install uv
7564
uses: astral-sh/setup-uv@v6
7665
with:
7766
enable-cache: true
7867
cache-dependency-glob: requirements*.txt
7968

8069
- name: Install dependencies
8170
run: |
82-
uv pip install --system tox tox-uv
71+
uv pip install --system -e .
8372
uv pip install --system pytest pytest-xdist pytest-cov
8473
85-
- name: Run tox targets for ${{ matrix.python-version }}
86-
run: tox -e ${{matrix.tox-python-version}} --parallel auto
74+
- name: Run tests
75+
run: |
76+
pytest --cov=json2xml --cov-report=xml:coverage/reports/coverage.xml --cov-report=term -xvs tests -n auto
8777
env:
8878
PYTHONPATH: ${{ github.workspace }}
8979

9080
- name: Upload coverage to Codecov
9181
uses: codecov/codecov-action@v5
92-
if: success() && matrix.tox-python-version != 'lint' && matrix.tox-python-version != 'typecheck'
82+
if: success()
9383
with:
9484
directory: ./coverage/reports/
9585
env_vars: OS,PYTHON
@@ -100,3 +90,63 @@ jobs:
10090
name: codecov-umbrella
10191
verbose: true
10292

93+
lint:
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
with:
98+
persist-credentials: false
99+
100+
- name: Set up Python 3.12
101+
uses: actions/[email protected]
102+
with:
103+
python-version: '3.12'
104+
cache: 'pip'
105+
cache-dependency-path: |
106+
requirements*.txt
107+
requirements-dev.in
108+
109+
- name: Install uv
110+
uses: astral-sh/setup-uv@v6
111+
with:
112+
enable-cache: true
113+
cache-dependency-glob: requirements*.txt
114+
115+
- name: Install dependencies
116+
run: |
117+
uv pip install --system -e .
118+
uv pip install --system ruff>=0.3.0
119+
120+
- name: Run ruff
121+
run: ruff check json2xml tests
122+
123+
typecheck:
124+
runs-on: ubuntu-latest
125+
steps:
126+
- uses: actions/checkout@v4
127+
with:
128+
persist-credentials: false
129+
130+
- name: Set up Python 3.12
131+
uses: actions/[email protected]
132+
with:
133+
python-version: '3.12'
134+
cache: 'pip'
135+
cache-dependency-path: |
136+
requirements*.txt
137+
requirements-dev.in
138+
139+
- name: Install uv
140+
uses: astral-sh/setup-uv@v6
141+
with:
142+
enable-cache: true
143+
cache-dependency-glob: requirements*.txt
144+
145+
- name: Install dependencies
146+
run: |
147+
uv pip install --system -e .
148+
uv pip install --system mypy>=1.0.0 types-setuptools
149+
150+
- name: Run mypy
151+
run: mypy json2xml tests
152+

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,27 @@ clean-pyc: ## remove Python file artifacts
4545
find . -name '__pycache__' -exec rm -fr {} +
4646

4747
clean-test: ## remove test and coverage artifacts
48-
rm -fr .tox/
4948
rm -f .coverage
5049
rm -fr htmlcov/
5150
rm -fr .pytest_cache
51+
rm -fr coverage/
5252

53-
lint: ## check style with flake8
54-
flake8 json2xml tests
53+
lint: ## check style with ruff
54+
ruff check json2xml tests
55+
56+
lint-fix: ## automatically fix ruff issues
57+
ruff check --fix json2xml tests
58+
59+
typecheck: ## check types with mypy
60+
mypy json2xml tests
5561

5662
test: ## run tests quickly with the default Python
57-
pytest -vv
63+
pytest --cov=json2xml --cov-report=xml:coverage/reports/coverage.xml --cov-report=term -xvs tests -n auto
64+
65+
test-simple: ## run tests without coverage
66+
pytest -vv tests
5867

59-
test-all: ## run tests on every Python version with tox
60-
tox
68+
check-all: lint typecheck test ## run all checks (lint, typecheck, test)
6169

6270
coverage: ## check code coverage quickly with the default Python
6371
coverage run -m pytest -vv --disable-warnings

README.rst

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,50 @@ Outputs this:
191191
The methods are simple and easy to use and there are also checks inside of code to exit cleanly
192192
in case any of the input(file, string or API URL) returns invalid JSON.
193193

194-
How to run tests
195-
^^^^^^^^^^^^^^^^
194+
Development
195+
^^^^^^^^^^^
196196

197-
This is provided by pytest, which is straight forward.
197+
This project uses modern Python development practices. Here's how to set up a development environment:
198198

199199
.. code-block:: console
200200
201-
virtualenv venv -p $(which python3.9)
202-
pip install -r requirements-dev.txt
203-
python setup.py install
204-
pytest -vv
201+
# Create and activate virtual environment (using uv - recommended)
202+
uv venv
203+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
204+
205+
# Install dependencies
206+
uv pip install -r requirements-dev.txt
207+
uv pip install -e .
208+
209+
**Running Tests and Checks**
210+
211+
We provide several ways to run tests and quality checks:
212+
213+
Using Make (recommended):
214+
215+
.. code-block:: console
216+
217+
make test # Run tests with coverage
218+
make lint # Run linting with ruff
219+
make typecheck # Run type checking with mypy
220+
make check-all # Run all checks (lint, typecheck, test)
221+
222+
Using the development script:
223+
224+
.. code-block:: console
225+
226+
python dev.py # Run all checks
227+
python dev.py test # Run tests only
228+
python dev.py lint # Run linting only
229+
python dev.py typecheck # Run type checking only
230+
231+
Using tools directly:
232+
233+
.. code-block:: console
234+
235+
pytest --cov=json2xml --cov-report=term -xvs tests -n auto
236+
ruff check json2xml tests
237+
mypy json2xml tests
205238
206239
207240
Help and Support to maintain this project

requirements-dev.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
xmltodict>=0.12.0
44
pytest
55
pytest-cov
6+
pytest-xdist>=3.5.0
67
coverage
78
py
8-
flake8
9+
ruff>=0.3.0
910
setuptools
10-
mypy
11+
mypy>=1.0.0
12+
types-setuptools

requirements-dev.txt

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
#
2-
# This file is autogenerated by pip-compile with Python 3.12
3-
# by the following command:
4-
#
5-
# pip-compile requirements-dev.in
6-
#
7-
coverage[toml]==7.6.11
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements-dev.in --output-file requirements-dev.txt
3+
coverage==7.6.11
84
# via
95
# -r requirements-dev.in
106
# pytest-cov
117
defusedxml==0.7.1
12-
# via -r /Users/vinitkumar/projects/python/json2xml/requirements.in
13-
flake8==7.1.1
14-
# via -r requirements-dev.in
8+
# via -r requirements.in
9+
execnet==2.1.1
10+
# via pytest-xdist
1511
iniconfig==2.0.0
1612
# via pytest
17-
mccabe==0.7.0
18-
# via flake8
1913
mypy==1.15.0
2014
# via -r requirements-dev.in
2115
mypy-extensions==1.0.0
@@ -26,22 +20,24 @@ pluggy==1.5.0
2620
# via pytest
2721
py==1.11.0
2822
# via -r requirements-dev.in
29-
pycodestyle==2.12.1
30-
# via flake8
31-
pyflakes==3.2.0
32-
# via flake8
3323
pytest==8.3.4
3424
# via
3525
# -r requirements-dev.in
3626
# pytest-cov
27+
# pytest-xdist
3728
pytest-cov==6.0.0
3829
# via -r requirements-dev.in
30+
pytest-xdist==3.7.0
31+
# via -r requirements-dev.in
32+
ruff==0.11.13
33+
# via -r requirements-dev.in
34+
setuptools==80.9.0
35+
# via -r requirements-dev.in
36+
types-setuptools==80.9.0.20250529
37+
# via -r requirements-dev.in
3938
typing-extensions==4.12.2
4039
# via mypy
4140
urllib3==2.3.0
42-
# via -r /Users/vinitkumar/projects/python/json2xml/requirements.in
41+
# via -r requirements.in
4342
xmltodict==0.14.2
4443
# via -r requirements-dev.in
45-
46-
# The following packages are considered to be unsafe in a requirements file:
47-
# setuptools

tox.ini

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)