Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .coverage
Binary file not shown.
87 changes: 83 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [pypy-3.10, pypy-3.11, '3.10', '3.11', '3.12', '3.13', '3.14']
python-version: [pypy-3.10, pypy-3.11, '3.10', '3.11', '3.12', '3.13', '3.14.0']
os: [
ubuntu-latest,
windows-latest,
macos-latest,
ubuntu-22.04,
windows-2022,
macos-14,
]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -142,3 +142,82 @@ jobs:
- name: Run mypy
run: mypy json2xml tests

test-freethreaded:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
python-version: '3.14.0'
arch: x64
platform: linux
- os: windows-2022
python-version: '3.14.0'
arch: x64
platform: win32
- os: macos-14
python-version: '3.14.0'
arch: x64
platform: darwin
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Download and setup Python ${{ matrix.python-version }} (freethreaded)
run: |
if [ "${{ matrix.platform }}" = "linux" ]; then
wget -O python.tar.gz "https://github.com/actions/python-versions/releases/download/3.14.0-18313368925/python-3.14.0-linux-22.04-${{ matrix.arch }}-freethreaded.tar.gz"
tar -xzf python.tar.gz
echo "$PWD/python-3.14.0-linux-22.04-${{ matrix.arch }}-freethreaded/bin" >> $GITHUB_PATH
elif [ "${{ matrix.platform }}" = "win32" ]; then
curl -L -o python.zip "https://github.com/actions/python-versions/releases/download/3.14.0-18313368925/python-3.14.0-win32-${{ matrix.arch }}-freethreaded.zip"
Expand-Archive python.zip -DestinationPath .
echo "$PWD/python-3.14.0-win32-${{ matrix.arch }}-freethreaded" >> $env:GITHUB_PATH
elif [ "${{ matrix.platform }}" = "darwin" ]; then
curl -L -o python.tar.gz "https://github.com/actions/python-versions/releases/download/3.14.0-18313368925/python-3.14.0-darwin-${{ matrix.arch }}-freethreaded.tar.gz"
tar -xzf python.tar.gz
echo "$PWD/python-3.14.0-darwin-${{ matrix.arch }}-freethreaded/bin" >> $GITHUB_PATH
fi

- name: Install uv
uses: astral-sh/setup-uv@v6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
enable-cache: true
cache-dependency-glob: |
requirements*.txt
requirements-dev.in
pyproject.toml

- name: Install dependencies
run: |
uv pip install --system -e .
uv pip install --system pytest pytest-xdist pytest-cov

- name: Create coverage directory
run: mkdir -p coverage/reports

- name: Run tests with freethreaded Python
run: |
pytest --cov=json2xml --cov-report=xml:coverage/reports/coverage.xml --cov-report=term -xvs tests -n auto
env:
PYTHONPATH: ${{ github.workspace }}
PYTHON_FREETHREADED: 1

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

if: success()
with:
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: false # Don't fail CI if codecov upload fails
files: ./coverage/reports/coverage.xml
flags: freethreaded
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-freethreaded
verbose: true
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}-freethreaded

4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ json2xml

.. image:: https://github.com/vinitkumar/json2xml/actions/workflows/pythonpackage.yml/badge.svg
.. image:: https://img.shields.io/pypi/pyversions/json2xml.svg
.. image:: https://img.shields.io/badge/python-3.14%20freethreaded-blue
.. image:: https://readthedocs.org/projects/json2xml/badge/?version=latest
:target: https://json2xml.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Expand Down Expand Up @@ -36,6 +37,7 @@ json2xml supports the following features:
* Conversion from a `json` string to XML
* Conversion from a `json` file to XML
* Conversion from an API that emits `json` data to XML
* Full compatibility with Python 3.14 freethreaded (GIL-free) builds

Usage
^^^^^
Expand Down Expand Up @@ -194,7 +196,7 @@ in case any of the input(file, string or API URL) returns invalid JSON.
Development
^^^^^^^^^^^

This project uses modern Python development practices. Here's how to set up a development environment:
This project uses modern Python development practices and supports both regular and freethreaded Python 3.14. Here's how to set up a development environment:

.. code-block:: console

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: CPython :: 3.14",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules"
]
Expand Down
Loading