Skip to content

Add Python 3.12 / 3.13 / 3.14 support (#122) #328

Add Python 3.12 / 3.13 / 3.14 support (#122)

Add Python 3.12 / 3.13 / 3.14 support (#122) #328

Workflow file for this run

name: Main (x64)
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test:
name: Build and Test
runs-on: self-hosted
container:
image: quantconnect/lean:foundation
options: --cpus 12 --memory 12g
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Install dependencies
run: |
pip install --upgrade -r requirements.txt
pip install numpy pytz # for tests
- name: Build and Install
run: |
pip install -v .
- name: Set Python DLL path and PYTHONHOME
run: |
echo PYTHONNET_PYDLL=$(python -m pythonnet.find_libpython) >> $GITHUB_ENV
echo PYTHONHOME=$(python -c 'import sys; print(sys.prefix)') >> $GITHUB_ENV
- name: Embedding tests
run: dotnet test --runtime any-x64 --logger "console;verbosity=detailed" src/embed_tests/ --filter "FullyQualifiedName!~SetPythonPath"
# SetPythonPath exercises PythonEngine.PythonPath, which uses the deprecated Py_SetPath
# to pin a fixed module search path. CPython 3.13+ keeps that path config in _PyRuntime
# across Py_Finalize and provides no way to reset it back to auto-computation without the
# PyConfig API, so once this test runs, every later interpreter re-initialization in the
# same process is forced onto the pinned path and eventually fails to import encodings.
# Run it in its own process so it cannot pollute the rest of the suite.
- name: Embedding tests (SetPythonPath, isolated process)
run: dotnet test --runtime any-x64 --logger "console;verbosity=detailed" src/embed_tests/ --filter "FullyQualifiedName~SetPythonPath"
- name: Python Tests (.NET Core)
run: pytest --runtime netcore tests
- name: Python tests run from .NET
run: dotnet test --runtime any-x64 src/python_tests_runner/