From 4c758e577494450bd5060873b1fff18bdeeece67 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 21:15:19 +0530 Subject: [PATCH 01/13] fix: update the tox settings --- .coverage | Bin 0 -> 53248 bytes .github/workflows/pythonpackage.yml | 74 ++++++++++++++++++++++------ .pre-commit-config.yaml | 64 ++++++++++++++++++++++++ pyproject.toml | 53 ++++++++++++++++++++ setup.py | 50 +------------------ tox.ini | 20 ++++---- 6 files changed, 186 insertions(+), 75 deletions(-) create mode 100644 .coverage create mode 100644 .pre-commit-config.yaml diff --git a/.coverage b/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..be1aa3037caab472076641afdf3d874d0154cf94 GIT binary patch literal 53248 zcmeI)Piz}i9tZFlkL{@)hX-maH$*5;NRUS4&xQ)B(yh7$LIqS}p;ZqcVaE1LGGNc7 zGvg+qYO^W3s)U3p4je$GaOTLN99Bz__5jizmWl%)1PCGi2t=}~*exY#&F?pVV!KT$ z4wWd~@5uK2d+*JApZCvWJK6i_9y?HS-1X{KAh&2YYPzodNlH!A^7QPcXR?^Ikxq7K zt+#EjwVBt3k38Nj_G^Xg3z~Sc`w=lzIMIE3*O@{+_k7n$)5=xo1QrND00I#B{}z~k zv|tu{di0}*1FKw9foD~e7rl1h_t@C3ePeRpu6y^4$>^BeoR_o=4ar^7bEoB$^5nQ( zQ_^;-cEt*8XF>*(Dhb{2Rh1_?I!03+2OJLL^H#~OQmjBtP!dy~UAMeh`HY$!3hT&xjBwLAU!p%JmplBALU}RT^+~|JU5p&i|g0x$5dD*%d60%tD`h@ zpjDIy$0?zT>s2}TWzTXdlgb~I)=CL0F6DD3h)V0Z^^w4pHQNb`>G*bFyN*;ds?rEl zb=3k6GFq|_UVCXMt*5v^Pen1~YqjaLBCirN4jxAyr_4ES!rF?+m!`;Jo}EU$Oyo~D z>Qh`f6eGHD;I0*Ot+;_37xq`z%_?=-DsM-1CgfbBQLKhzA84qR${&=in1f+49CuK1 zA*co1)|D-8Td!->D%FgCphoYvN>(Fq!~GIferc3m3V*$6omuSb(~lhp8w&H3%68zd zY~(r`&C205nhu{|yWMav>1-t2i)uCLj)z@_W6P*=s5Q6unUMs;^0=c(Hx5WS{Y_gN zXO{9H%Qd&$+1A1q<16YQG!`Vm#v4wByNb_csJI7}XHBT#_-r&R{MHSLn$Bo0TO8|K ztLdyXfzs&8W`4dWYZiNZ^`p748O5~~ugs1nl+@%Z!)S7JdCH@iWs=2tLy40+&n#zdrj@Rxl|q z&pRKcjQ3}<#qAr{$~b4CG|I2p=blJ~Sw7Yi>ep$|=cmz;Wj@l%^22I&=%7`j(PYZ9 zJ?gSF21hf1~#GXP8gu$tM|Jn6@o2FHsw)}gN zqq2X}@_7{U`(@d6Yszw>xq)Il=+iZAUxs9j<)I~2zGf6Z)%Oh5j{_qr;aH@5y8g+NB zl(rP7C)H)iMYGZUR-gjAt|SKuGZQwfY0H-tPti%5O9%RmD>VbIt00Izz00bZa0SG_<0uX?}?^B?VGHwycPdxr0bfdQz{|I2~@ZH1P_(%RJ@vSDl z761Kx77)3H00bZa0SG_<0uX=z1Rwwb2tXhaC>Xcs$)^CRywRJBKLp_K|4s3jCcYE@ z7N^7sF)t=*7YhU+009U<00Izz00bZa0SG_<0#_8+U>e%U)4uE6Ia9BVGy=Qk)BhzX zW)1DGm7~c9o#@FJ+O|OXfj`2prM6R>(uTG**&m^QX%qx5rOBxo?WvVYwqpmS5~r5x zOpPOPKIqg2o$?i3s4W72|8I)Dns`gRDr~V=d@tS?N3U2woP+=bAOHafKmY;|fB*y_ z009UD}Ya%6rXIA7A|PxVAi}X>xAIhyISH=p=4_ zxco}ipgi1Q+%uNq>*Q1WkL-T?#hu&FzSej4*~4dlKC%4w0IuHRP^`%XEd=SeiT25 zuf^x$BXOql>ezz-1Rwwb2tWV=5P$##AOHafK;Rk^;Lj~|(+pSHY`Dr~!c{sQt_&kw zrBZ4703iJSU%T-dD+96v0SG_<0uX=z1Rwwb2tWV=5P-l{6$pRokNf|tYKp`l009U< z00Izz00bZa0SG_<0@s=V|NTF{|G(C11^Iyh1Rwwb2tWV=5P$##AOHafTwQ@*010^< A1ONa4 literal 0 HcmV?d00001 diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4477245..ad73886 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -30,26 +30,68 @@ jobs: os: macos-latest steps: - - uses: actions/checkout@v4.1.7 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.2.0 with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade -r requirements-dev.txt - pip install . - - name: Test with pytest - run: | - pytest --cov --junitxml=junit.xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + - name: install uv + uses: astral-sh/setup-uv@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload test results to Codecov - if: ${{ !cancelled() }} - uses: codecov/test-results-action@v1 + enable-cache: true + cache-dependency-glob: requirements-dev.txt + + - name: Install dependencies + run: uv pip install --system tox tox-uv + + - name: Run tox targets for ${{ matrix.python-version }} + run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) + + - name: Upload coverage data + uses: actions/upload-artifact@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} + name: coverage-data-${{ matrix.python-version }} + path: '${{ github.workspace }}/.coverage.*' + include-hidden-files: true + if-no-files-found: error + + + coverage: + name: Coverage + runs-on: ubuntu-24.04 + needs: build + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install uv + uses: astral-sh/setup-uv@v3 + + - name: Install dependencies + run: uv pip install --system coverage[toml] + + - name: Download data + uses: actions/download-artifact@v4 + with: + path: ${{ github.workspace }} + pattern: coverage-data-* + merge-multiple: true + + - name: Combine coverage and fail if it's <100% + run: | + python -m coverage combine + python -m coverage html --skip-covered --skip-empty + python -m coverage report --fail-under=90 + echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY + python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY + + - name: Upload HTML report + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: html-report + path: htmlcov diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bd7afd0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,64 @@ +ci: + autofix_commit_msg: | + ci: auto fixes from pre-commit hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_commit_msg: 'ci: pre-commit autoupdate' + autoupdate_schedule: monthly + +default_language_version: + python: python3.12 + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-json + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.5.0 + hooks: + - id: pyproject-fmt +- repo: https://github.com/tox-dev/tox-ini-fmt + rev: 1.4.1 + hooks: + - id: tox-ini-fmt +- repo: https://github.com/rstcheck/rstcheck + rev: v6.2.4 + hooks: + - id: rstcheck + additional_dependencies: + - tomli==2.0.1 +- repo: https://github.com/asottile/pyupgrade + rev: v3.19.0 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.10.0 + hooks: + - id: black +- repo: https://github.com/adamchainz/blacken-docs + rev: 1.19.1 + hooks: + - id: blacken-docs + additional_dependencies: + - black==23.1.0 +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.13.0 + hooks: + - id: mypy + additional_dependencies: + - django-stubs==5.0.4 diff --git a/pyproject.toml b/pyproject.toml index 9434ded..4f4dc6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,56 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "json2xml" +version = "5.0.5" # Replace with the dynamic version if needed +description = "Simple Python Library to convert JSON to XML" +readme = "README.rst" +requires-python = ">=3.10" +license = { text = "Apache Software License 2.0" } +keywords = ["json2xml"] +authors = [ + { name = "Vinit Kumar", email = "mail@vinitkumar.me" } +] +classifiers = [ + "Development Status :: 6 - Mature", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries :: Python Modules" +] +dependencies = [ + "defusedxml", + "urllib3", + "xmltodict>=0.12.0", + "pytest", + "pytest-cov", + "coverage", + "py", + "setuptools", +] + +[project.urls] +Homepage = "https://github.com/vinitkumar/json2xml" + +[tool.setuptools.packages.find] +include = ["json2xml"] + +[project.optional-dependencies] +test = [ + "pytest==7.0.1", + "py==1.11.0" +] + +[tool.pytest.ini_options] +testpaths = ["tests"] [tool.ruff] exclude = [ ".env", diff --git a/setup.py b/setup.py index e986ed2..56db080 100644 --- a/setup.py +++ b/setup.py @@ -2,52 +2,6 @@ """The setup script.""" -from setuptools import setup, find_packages -from json2xml import __version__ +from setuptools import setup +setup() -with open("README.rst", encoding="utf-8") as readme_file: - readme = readme_file.read() - -with open("HISTORY.rst", encoding="utf-8") as history_file: - history = history_file.read() - -with open("requirements.in", encoding="utf-8") as requirements_in: - requirements = [requirements_in.read()] - -setup_requirements = [] - -test_requirements = ["pytest==7.0.1", "py==1.11.0"] - -setup( - author="Vinit Kumar", - author_email="mail@vinitkumar.me", - classifiers=[ - "Development Status :: 6 - Mature", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - description="Simple Python Library to convert JSON to XML", - install_requires=requirements, - license="Apache Software License 2.0", - long_description=readme + "\n\n" + history, - long_description_content_type="text/x-rst", - include_package_data=True, - keywords="json2xml", - name="json2xml", - packages=find_packages(include=["json2xml"]), - setup_requires=setup_requirements, - test_suite="tests", - tests_require=test_requirements, - url="https://github.com/vinitkumar/json2xml", - version=__version__, - zip_safe=False, - python_requires=">=3.10", -) diff --git a/tox.ini b/tox.ini index 0d5027e..e726689 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,5 @@ [tox] -envlist = py38, py39, py310, py311, py312, pypy38, pypy39 - - -[testenv:flake8] -basepython = python -deps = flake8 -commands = flake8 json2xml +envlist = py310, py311, py312, py313, py314, pypy310 [testenv] setenv = @@ -13,8 +7,12 @@ setenv = allowlist_externals = pytest -commands = - pip install -r requirements-dev.txt - pytest - +; pytest +commands = + python \ + -W error::ResourceWarning \ + -W error::DeprecationWarning \ + -W error::PendingDeprecationWarning \ + -m coverage run \ + -m pytest {posargs:tests} From 4c92a48fdf77d9a30963abf1487e529410058c69 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:10:23 +0530 Subject: [PATCH 02/13] fix: one more attempt at failing builds --- .github/workflows/pythonpackage.yml | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index ad73886..941858d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -46,7 +46,7 @@ jobs: run: uv pip install --system tox tox-uv - name: Run tox targets for ${{ matrix.python-version }} - run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) + run: tox - name: Upload coverage data uses: actions/upload-artifact@v4 diff --git a/tox.ini b/tox.ini index e726689..fd9bef3 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,6 @@ setenv = allowlist_externals = pytest -; pytest commands = python \ From 63887a9f6b766ee2539d66b5b60a0de789e04f15 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:15:00 +0530 Subject: [PATCH 03/13] fix: one more attempt at coverage --- tox.ini | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index fd9bef3..ae2c22d 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,11 @@ envlist = py310, py311, py312, py313, py314, pypy310 [testenv] -setenv = - PYTHONPATH = {toxinidir} +deps = + pytest + pytest-cov +commands = + pytest --cov=json2xml --cov-report=xml allowlist_externals = pytest From 9aa47c5f13b449596f9ea91eace026defabacf9b Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:22:55 +0530 Subject: [PATCH 04/13] fix: issues with tox ini --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index ae2c22d..2bb7573 100644 --- a/tox.ini +++ b/tox.ini @@ -5,13 +5,11 @@ envlist = py310, py311, py312, py313, py314, pypy310 deps = pytest pytest-cov -commands = - pytest --cov=json2xml --cov-report=xml allowlist_externals = pytest - commands = + pytest --cov=json2xml --cov-report=xml python \ -W error::ResourceWarning \ -W error::DeprecationWarning \ From 783b31050016b58a98cca2a6eb39f391f0416a12 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:31:22 +0530 Subject: [PATCH 05/13] fix: one more try --- .coverage | Bin 53248 -> 53248 bytes .github/workflows/pythonpackage.yml | 3 +- .gitignore | 145 +++++++++++++++++++++++++--- 3 files changed, 133 insertions(+), 15 deletions(-) diff --git a/.coverage b/.coverage index be1aa3037caab472076641afdf3d874d0154cf94..c17c3decc717cd8b2f8f33628c4e9d00f0214a43 100644 GIT binary patch delta 61 zcmV-D0K)%(paX!Q1F&k3F2D#0Cji-S0u1}Z{FQ+I|NR7H3-n2%^cjN%=r delta 61 zcmV-D0K)%(paX!Q1F&k3F8>J$Cji-S{vZ3p{FVRz|NZ=L3- Date: Tue, 17 Dec 2024 22:35:38 +0530 Subject: [PATCH 06/13] fix: ci --- .github/workflows/pythonpackage.yml | 43 +---------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 976a459..f20d5cb 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -53,46 +53,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: coverage-data-${{ matrix.python-version }} - path: '${{ github.workspace }}/.coverage.*' - include-hidden-files: true - if-no-files-found: error + token: ${{ secrets.CODECOV_TOKEN }} - - coverage: - name: Coverage - runs-on: ubuntu-24.04 - needs: build - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install uv - uses: astral-sh/setup-uv@v3 - - - name: Install dependencies - run: uv pip install --system coverage[toml] - - - name: Download data - uses: actions/download-artifact@v4 - with: - path: ${{ github.workspace }} - pattern: coverage-data-* - merge-multiple: true - - - name: Combine coverage and fail if it's <100% - run: | - python -m coverage combine - python -m coverage html --skip-covered --skip-empty - python -m coverage report --fail-under=90 - echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY - python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY - - - name: Upload HTML report - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: html-report - path: htmlcov From ef0c8ec097e52996a5dfda9a5861e591050c9a37 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:39:35 +0530 Subject: [PATCH 07/13] fix: another try --- .github/workflows/pythonpackage.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index f20d5cb..15881c4 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -49,9 +49,14 @@ jobs: - name: Run tox targets for ${{ matrix.python-version }} run: tox -e ${{matrix.tox-python-version}} - - name: Upload coverage data - uses: actions/upload-artifact@v4 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 with: - name: coverage-data-${{ matrix.python-version }} token: ${{ secrets.CODECOV_TOKEN }} From fcf934add47ee956d79e68725aa78572c5acd02c Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:42:56 +0530 Subject: [PATCH 08/13] fix: one more try --- .github/workflows/pythonpackage.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 15881c4..4295e0b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -32,6 +32,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5.2.0 with: @@ -51,8 +54,8 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} + with: + token: ${{ secrets.CODECOV_TOKEN }} - name: Upload test results to Codecov if: ${{ !cancelled() }} From cdd3ef5a6cb38dec7a39618053713feba6bab9b4 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 22:45:41 +0530 Subject: [PATCH 09/13] fix: update tox to emit junit format for coveralls --- tox.ini | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tox.ini b/tox.ini index 2bb7573..dce1173 100644 --- a/tox.ini +++ b/tox.ini @@ -9,10 +9,4 @@ deps = allowlist_externals = pytest commands = - pytest --cov=json2xml --cov-report=xml - python \ - -W error::ResourceWarning \ - -W error::DeprecationWarning \ - -W error::PendingDeprecationWarning \ - -m coverage run \ - -m pytest {posargs:tests} + pytest --cov --junitxml=junit.xml From 4e15970e2683503fb906dd2a3e864d26396509aa Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 23:06:36 +0530 Subject: [PATCH 10/13] fix: try to get python 3.14 to work --- .github/workflows/pythonpackage.yml | 9 ++++++--- tox.ini | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 4295e0b..9396564 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -21,14 +21,17 @@ jobs: ] include: # Add exact version 3.14.0-alpha.0 for ubuntu-latest only - - python-version: '3.14.0-alpha.0' + - python-version: '3.14.0-alpha.1' + tox-python-version: py314-full os: ubuntu-latest exclude: # Exclude other OSes with Python 3.14.0-alpha.0 - - python-version: '3.14.0-alpha.0' + - python-version: '3.14.0-alpha.1' + tox-python-version: py314-full os: windows-latest - - python-version: '3.14.0-alpha.0' + - python-version: '3.14.0-alpha.1' os: macos-latest + tox-python-version: py314-full steps: - uses: actions/checkout@v4 diff --git a/tox.ini b/tox.ini index dce1173..228574a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py310, py311, py312, py313, py314, pypy310 +envlist = py310, py311, py312, py313, py314, pypy310, py314-full [testenv] deps = From 49ee5c802f2f76580cb112767d60b1cbd3ffded3 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 23:12:14 +0530 Subject: [PATCH 11/13] fix: try to fix tox config --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 228574a..9b77069 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py310, py311, py312, py313, py314, pypy310, py314-full +envlist = py310, py311, py312, py313, pypy310, py314-full [testenv] deps = From 6c5575e8cdb462718f8d5ccd9fe92d87658f268b Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 23:20:35 +0530 Subject: [PATCH 12/13] fix: issues with types --- .coverage | Bin 53248 -> 53248 bytes json2xml/dicttoxml.py | 4 ++-- junit.xml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 junit.xml diff --git a/.coverage b/.coverage index c17c3decc717cd8b2f8f33628c4e9d00f0214a43..78ccbc0b5adc4a28bd51a678d6d2c09ea1d0cd14 100644 GIT binary patch delta 131 zcmZozz}&Ead4e<}=R_H2M$U~1T>X0gIXTrCZWjEL|9$q))c^ng|NWEC{q4u`{{P7* z{%^ba?{PoFpLzxcg?iiT#kT+XH_zzLF%V+szstb?oBtdCNB%eb&-owm-`y-IaGYP6 anVp$|mzfPju!0B{5Wx&0m_P(0kN^PeD03`@{T|fd2pe1Y`^L_{Wd` iV@N=@+5Y2?0Q`Rd03b0v(=$E&2eX)uY%sF~p!^T9@FB1O diff --git a/json2xml/dicttoxml.py b/json2xml/dicttoxml.py index 2ba6af9..d51d98b 100644 --- a/json2xml/dicttoxml.py +++ b/json2xml/dicttoxml.py @@ -269,10 +269,10 @@ def dict2xml_str( val_attr: dict[str, str] = item.pop("@attrs", attr) # update attr with custom @attr if exists rawitem = item["@val"] if "@val" in item else item if is_primitive_type(rawitem): + if isinstance(rawitem, dict): + subtree = escape_xml(str(rawitem)) if isinstance(rawitem, str): subtree = escape_xml(rawitem) - else: - subtree = rawitem else: # we can not use convert_dict, because rawitem could be non-dict subtree = convert( diff --git a/junit.xml b/junit.xml new file mode 100644 index 0000000..d0816c2 --- /dev/null +++ b/junit.xml @@ -0,0 +1 @@ + \ No newline at end of file From 46ec3f5a26f9127bce7131ef01d3afb779a41c94 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 23:34:55 +0530 Subject: [PATCH 13/13] fix: update pre-commit config --- .coverage | Bin 53248 -> 53248 bytes .pre-commit-config.yaml | 2 +- junit.xml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.coverage b/.coverage index 78ccbc0b5adc4a28bd51a678d6d2c09ea1d0cd14..672c021d25a5e0609e70b471239c8dfd0f5b4c61 100644 GIT binary patch delta 15 XcmZozz}&Eac|sCX-p-9FbIt<*G0Fzw delta 15 WcmZozz}&Eac|sCXUDU>uIp+Z|PX?0! diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd7afd0..ad27619 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: additional_dependencies: - tomli==2.0.1 - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.19.1 hooks: - id: pyupgrade args: [--py38-plus] diff --git a/junit.xml b/junit.xml index d0816c2..fef39a8 100644 --- a/junit.xml +++ b/junit.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file