From 4c758e577494450bd5060873b1fff18bdeeece67 Mon Sep 17 00:00:00 2001 From: Vinit kumar Date: Tue, 17 Dec 2024 21:15:19 +0530 Subject: [PATCH] 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%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009U< 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}