Add Python 3.12 / 3.13 / 3.14 support #298
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| # The fixtures that repeatedly tear down and re-initialize the interpreter | |
| # (TestPythonEngineProperties / pyinitialize / TestFinalizer) are run in a separate | |
| # process. CPython 3.13+ does not fully support repeated Py_Finalize/Py_Initialize: | |
| # accumulating ~40 per-fixture re-inits in one process eventually corrupts interpreter | |
| # state ("Failed to import encodings module"). Isolating the re-init-heavy fixtures | |
| # keeps each process's accumulation low. TestDomainReload is excluded entirely: | |
| # AppDomain reload is not supported on modern .NET (single-domain), so it is obsolete. | |
| - name: Embedding tests | |
| run: dotnet test --runtime any-x64 --logger "console;verbosity=detailed" src/embed_tests/ --filter "FullyQualifiedName!~TestPythonEngineProperties&FullyQualifiedName!~pyinitialize&FullyQualifiedName!~TestFinalizer&FullyQualifiedName!~TestDomainReload" | |
| - name: Embedding tests (re-initialization fixtures, isolated process) | |
| run: dotnet test --runtime any-x64 --logger "console;verbosity=detailed" src/embed_tests/ --filter "FullyQualifiedName~TestPythonEngineProperties|FullyQualifiedName~pyinitialize|FullyQualifiedName~TestFinalizer" | |
| - 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/ |