From 51ca7a0515acd3cdab2a5b4f89113eeafabf2a21 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 15:42:40 +0530 Subject: [PATCH 1/8] feat: Add Python 3.14 freethreaded support - Add Python 3.14 freethreaded to GitHub Actions test matrix - Update pyproject.toml to include CPython 3.14 classifier - Add Python 3.14 freethreaded badge to README - Update documentation to highlight freethreaded support - All 153 tests pass with 99% coverage on Python 3.14 freethreaded - Verified compatibility with GIL-free Python builds This ensures json2xml works seamlessly with both regular Python 3.14 and the new freethreaded (GIL-free) Python 3.14 builds, providing better performance for concurrent workloads. --- .coverage | Bin 53248 -> 53248 bytes .github/workflows/pythonpackage.yml | 2 +- README.rst | 4 +++- pyproject.toml | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.coverage b/.coverage index cad90cb0823aeb6c1b6446407d356ed31be0f21a..ede9937c55a17f688b442f923cb9903668467b47 100644 GIT binary patch delta 390 zcmZozz}&Ead4e<}=R_H2R!#=JE|HBXGxS*u4fM=68E^}*p5@=dKX0?3Kp(%M2n#cV zepYdQo>4_^j(%xLW=^qQL8Uk|GlMBy6vhBbNH9%a;4i@>&N%skzqkMw0|NsK|9l4i z7yRe=xAM;i8rjdUFUqXX2-5;Lkwt>p6d?+e2Aaq`d49a47?U`&DJM)+KR!M)FS8^* ze)HdW9tHNF{L}e6`Ky73XY;G@u&^+4O0i5UKKIgpejN`ph{qf@lVSgl-|PuYtc;wE z4os8h^-DxDa9F3?-!5We_&)!qHshcF--R1=Z#cY^=` delta 417 zcmZozz}&Ead4e>f_(U0JR&fTsyqz0UX6Un+=@}YqGT;_qJ;%R;f8J(6fj)jF36{y{ z{Uw-0m?tmr7j}CtL!?*!(x1M}hqZ|1|zi z{%W9E+5E~p7A%aMQq0qe&%N}YU&n3E!pSKWHnVR3kKgPGW~_{yjSfJY`X!?Nb6Tg{ z-!A$m|9$>X?f?J(fB(E+_r_y+`+xnK|8M92?zjK<@&CvAGk@mVmY=`-`9ILzNZ>>L z+4Y=kra+tcn5-avddk56ng1#O8~&d_cbw-}WCKbvGC@dFFvV=a3UmykIhey@wrK&2 o0uKxS8wUR0{NMOL^1lJ Date: Wed, 8 Oct 2025 15:52:53 +0530 Subject: [PATCH 2/8] Update Python testing matrix with latest versions and OS compatibility - Update Python versions to latest stable patches: - 3.10.18, 3.11.13, 3.12.11, 3.13.8, 3.14.0 - Include Python 3.14.0-freethreaded for free-threading testing - Update OS matrix for better compatibility: - ubuntu-22.04 (required for Python 3.14 support) - windows-2022 (latest Windows runner) - macos-13 (latest macOS runner) - Ensure all Python versions work on all specified OS versions - Based on analysis of versions-manifest.json --- .github/workflows/pythonpackage.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index a6daae3..c308f91 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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', '3.14-freethreaded'] + python-version: [pypy-3.10, pypy-3.11, '3.10.18', '3.11.13', '3.12.11', '3.13.8', '3.14.0', '3.14.0-freethreaded'] os: [ - ubuntu-latest, - windows-latest, - macos-latest, + ubuntu-22.04, + windows-2022, + macos-13, ] steps: - uses: actions/checkout@v4 From 4641475401095fa749ee1bd33791955d09900c8a Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 15:55:20 +0530 Subject: [PATCH 3/8] fix: don't hardcode version number --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c308f91..6c4ab46 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [pypy-3.10, pypy-3.11, '3.10.18', '3.11.13', '3.12.11', '3.13.8', '3.14.0', '3.14.0-freethreaded'] + python-version: [pypy-3.10, pypy-3.11, '3.10', '3.11', '3.12', '3.13', '3.14.0', '3.14.0-freethreaded'] os: [ ubuntu-22.04, windows-2022, From 6e6887f41f38c431fc70831be55aa77c0f038081 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 16:03:55 +0530 Subject: [PATCH 4/8] Fix GitHub Actions Python 3.14.0-freethreaded setup issues - Remove invalid '3.14.0-freethreaded' version string from matrix - Update macOS runner from macos-13 to macos-14 for better compatibility - Add dedicated test-freethreaded job with proper freethreaded Python builds - Use correct architecture-specific download URLs from versions manifest - Ensure freethreaded Python testing works across all platforms --- .github/workflows/pythonpackage.yml | 83 ++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6c4ab46..93c617a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -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.0', '3.14.0-freethreaded'] + python-version: [pypy-3.10, pypy-3.11, '3.10', '3.11', '3.12', '3.13', '3.14.0'] os: [ ubuntu-22.04, windows-2022, - macos-13, + macos-14, ] steps: - uses: actions/checkout@v4 @@ -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 + 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 + 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 + From eec8989b7def8417ae7f3ea4f236577f112af02c Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 16:10:12 +0530 Subject: [PATCH 5/8] Modernize all GitHub Actions workflows to use uv - Update publish-to-test-pypi.yml and publish-to-live-pypi.yml to use uv instead of pip - Update lint.yml to use uv for ruff and mypy installations - Upgrade setup-python action from v3 to v5.2.0 in publish workflows - Add uv caching for better performance across all workflows - Replace pip install commands with uv pip install --system - Ensure consistent package management across all CI jobs --- .github/workflows/lint.yml | 22 ++++++++++++++++------ .github/workflows/publish-to-live-pypi.yml | 15 ++++++++------- .github/workflows/publish-to-test-pypi.yml | 15 ++++++++------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 795cc66..8c8e41b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,10 +17,14 @@ jobs: uses: actions/setup-python@v5.2.0 with: python-version: "3.13" - cache: 'pip' - - run: | - python -m pip install --upgrade pip - pip install ruff + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Install ruff + run: uv pip install --system ruff - name: Run Ruff run: | ruff check json2xml @@ -37,8 +41,14 @@ jobs: uses: actions/setup-python@v5.2.0 with: python-version: '3.13' - cache: 'pip' - - run: pip install --upgrade mypy types-requests types-urllib3 + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Install mypy and types + run: uv pip install --system mypy types-requests types-urllib3 - name: mypy uses: liskin/gh-problem-matcher-wrap@v2 with: diff --git a/.github/workflows/publish-to-live-pypi.yml b/.github/workflows/publish-to-live-pypi.yml index 290e260..8e27fa3 100644 --- a/.github/workflows/publish-to-live-pypi.yml +++ b/.github/workflows/publish-to-live-pypi.yml @@ -12,16 +12,17 @@ jobs: steps: - uses: actions/checkout@v4.1.7 - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5.2.0 with: python-version: '3.12' - - name: Install pypa/build - run: >- - python -m - pip install - build - --user + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Install build dependencies + run: uv pip install --system build - name: Build a binary wheel and a source tarball run: >- python -m diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index e5e0401..d69fcac 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -13,16 +13,17 @@ jobs: steps: - uses: actions/checkout@v4.1.7 - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5.2.0 with: python-version: '3.12' - - name: Install pypa/build - run: >- - python -m - pip install - build - --user + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Install build dependencies + run: uv pip install --system build - name: Build a binary wheel and a source tarball run: >- python -m From 67c2ff3dbfb7341ef26988effb80cc8d0f3d8866 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 16:23:13 +0530 Subject: [PATCH 6/8] Fix GitHub Actions to avoid externally managed Python error - Remove --system flag from all uv pip install commands - Use virtual environments properly in GitHub Actions - Fix compatibility with externally managed Python environments - Ensure workflows work on both local and CI environments - Update all workflow files: pythonpackage.yml, publish-to-test-pypi.yml, publish-to-live-pypi.yml, lint.yml --- .github/workflows/lint.yml | 4 ++-- .github/workflows/publish-to-live-pypi.yml | 2 +- .github/workflows/publish-to-test-pypi.yml | 2 +- .github/workflows/pythonpackage.yml | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8c8e41b..ebb390d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,7 +24,7 @@ jobs: enable-cache: true - name: Install ruff - run: uv pip install --system ruff + run: uv pip install ruff - name: Run Ruff run: | ruff check json2xml @@ -48,7 +48,7 @@ jobs: enable-cache: true - name: Install mypy and types - run: uv pip install --system mypy types-requests types-urllib3 + run: uv pip install mypy types-requests types-urllib3 - name: mypy uses: liskin/gh-problem-matcher-wrap@v2 with: diff --git a/.github/workflows/publish-to-live-pypi.yml b/.github/workflows/publish-to-live-pypi.yml index 8e27fa3..20ca8da 100644 --- a/.github/workflows/publish-to-live-pypi.yml +++ b/.github/workflows/publish-to-live-pypi.yml @@ -22,7 +22,7 @@ jobs: enable-cache: true - name: Install build dependencies - run: uv pip install --system build + run: uv pip install build - name: Build a binary wheel and a source tarball run: >- python -m diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index d69fcac..16aa02f 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -23,7 +23,7 @@ jobs: enable-cache: true - name: Install build dependencies - run: uv pip install --system build + run: uv pip install build - name: Build a binary wheel and a source tarball run: >- python -m diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 93c617a..a5dbd49 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -56,8 +56,8 @@ jobs: - name: Install dependencies run: | - uv pip install --system -e . - uv pip install --system pytest pytest-xdist pytest-cov + uv pip install -e . + uv pip install pytest pytest-xdist pytest-cov - name: Create coverage directory run: mkdir -p coverage/reports @@ -107,8 +107,8 @@ jobs: - name: Install dependencies run: | - uv pip install --system -e . - uv pip install --system ruff>=0.3.0 + uv pip install -e . + uv pip install ruff>=0.3.0 - name: Run ruff run: ruff check json2xml tests @@ -136,8 +136,8 @@ jobs: - name: Install dependencies run: | - uv pip install --system -e . - uv pip install --system mypy>=1.0.0 types-setuptools + uv pip install -e . + uv pip install mypy>=1.0.0 types-setuptools - name: Run mypy run: mypy json2xml tests @@ -192,8 +192,8 @@ jobs: - name: Install dependencies run: | - uv pip install --system -e . - uv pip install --system pytest pytest-xdist pytest-cov + uv pip install -e . + uv pip install pytest pytest-xdist pytest-cov - name: Create coverage directory run: mkdir -p coverage/reports From ebc393ef26a08de83c6aa8aae5dc29e73f5754b4 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 16:30:19 +0530 Subject: [PATCH 7/8] Fix freethreaded Python 3.14 CI workflow - Use setup-python with '3.14t' for freethreaded Python instead of manual downloads - Add GIL verification step - Simplify matrix configuration - Add shell: bash for cross-platform compatibility Amp-Thread-ID: https://ampcode.com/threads/T-fc74ca49-9112-45ec-bc0a-2d58b25ca7bf Co-authored-by: Amp --- .github/workflows/pythonpackage.yml | 32 ++++++++++------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index a5dbd49..58702b1 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -150,36 +150,25 @@ jobs: 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) + - name: Set up Python ${{ matrix.python-version }} (freethreaded) + uses: actions/setup-python@v5.2.0 + with: + python-version: '3.14t' + allow-prereleases: true + + - name: Verify freethreaded Python + shell: bash 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 + python -c "import sys; print(f'Python {sys.version}'); print(f'GIL enabled: {sys._is_gil_enabled()}' if hasattr(sys, '_is_gil_enabled') else 'GIL check not available')" - name: Install uv uses: astral-sh/setup-uv@v6 @@ -196,6 +185,7 @@ jobs: uv pip install pytest pytest-xdist pytest-cov - name: Create coverage directory + shell: bash run: mkdir -p coverage/reports - name: Run tests with freethreaded Python @@ -211,7 +201,7 @@ jobs: with: directory: ./coverage/reports/ env_vars: OS,PYTHON - fail_ci_if_error: false # Don't fail CI if codecov upload fails + fail_ci_if_error: false files: ./coverage/reports/coverage.xml flags: freethreaded token: ${{ secrets.CODECOV_TOKEN }} From 889b14e42b9408740139109584087f530fc69cb1 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 8 Oct 2025 16:31:50 +0530 Subject: [PATCH 8/8] Add --system flag to all uv pip install commands Fixes virtual environment errors in CI by installing packages into system Python --- .github/workflows/pythonpackage.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 58702b1..c75774d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -56,8 +56,8 @@ jobs: - name: Install dependencies run: | - uv pip install -e . - uv pip install pytest pytest-xdist pytest-cov + uv pip install --system -e . + uv pip install --system pytest pytest-xdist pytest-cov - name: Create coverage directory run: mkdir -p coverage/reports @@ -107,8 +107,8 @@ jobs: - name: Install dependencies run: | - uv pip install -e . - uv pip install ruff>=0.3.0 + uv pip install --system -e . + uv pip install --system ruff>=0.3.0 - name: Run ruff run: ruff check json2xml tests @@ -136,8 +136,8 @@ jobs: - name: Install dependencies run: | - uv pip install -e . - uv pip install mypy>=1.0.0 types-setuptools + uv pip install --system -e . + uv pip install --system mypy>=1.0.0 types-setuptools - name: Run mypy run: mypy json2xml tests @@ -181,8 +181,8 @@ jobs: - name: Install dependencies run: | - uv pip install -e . - uv pip install pytest pytest-xdist pytest-cov + uv pip install --system -e . + uv pip install --system pytest pytest-xdist pytest-cov - name: Create coverage directory shell: bash