Skip to content

🆙 Add Python 3.14 Support #1670

🆙 Add Python 3.14 Support

🆙 Add Python 3.14 Support #1670

Workflow file for this run

name: pip Install
on:
push:
paths:
- "requirements*.yml"
- "conda-env-create.yml"
- "requirements/requirement*.txt"
- "setup*py"
- "setup*cfg"
- "pyproject*toml"
- "MANIFEST*in"
- ".github/workflows/pip-install.yml"
pull_request:
paths:
- "requirements*.yml"
- "conda-env-create.yml"
- "requirements/requirement*.txt"
- "setup*py"
- "setup*cfg"
- "pyproject*toml"
- "MANIFEST*in"
- ".github/workflows/pip-install.yml"
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-24.04, windows-latest, macos-latest]
# Force UTF-8 everywhere (Windows is the one that really needs it)
env:
PYTHONUTF8: "1"
PYTHONIOENCODING: "utf-8"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
channel-priority: strict
auto-update-conda: true
# -------------------------------
# Create environment (Linux/macOS)
# -------------------------------
- name: Create conda environment (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda create -y -n test-env python=${{ matrix.python-version }}
conda activate test-env
conda install -y openjpeg sqlite
python -m pip install --upgrade pip setuptools wheel
# -------------------------------
# Create environment (Windows)
# -------------------------------
- name: Create conda environment (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda create -y -n test-env python=${{ matrix.python-version }}
conda activate test-env
conda install -y openjpeg sqlite
python -m pip install --upgrade pip setuptools wheel
# -------------------------------
# Verify SQLite
# -------------------------------
- name: Verify SQLite (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate test-env
sqlite3 --version
sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
- name: Verify SQLite (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda activate test-env
sqlite3 --version
sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
# -------------------------------
# Verify OpenJPEG
# -------------------------------
- name: Verify OpenJPEG (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate test-env
opj_dump -h || true # -h exits with code 1 in some builds
- name: Verify OpenJPEG (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda activate test-env
opj_dump -h || true # -h exits with code 1 in some builds
# -------------------------------
# Install PyTorch (CPU-only)
# -------------------------------
- name: Install CPU-only PyTorch (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate test-env
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Install CPU-only PyTorch (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda activate test-env
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
# -------------------------------
# (Windows only) make console UTF-8 (extra safety)
# -------------------------------
- name: Ensure UTF-8 console (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
chcp 65001 > $null
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# -------------------------------
# Install tiatoolbox from this commit
# -------------------------------
- name: Install tiatoolbox (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate test-env
pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA}
- name: Install tiatoolbox (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda activate test-env
pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_SHA
# -------------------------------
# Test Imports
# -------------------------------
- name: Test Imports (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate test-env
python - << 'EOF'
import tiatoolbox
print("tiatoolbox:", tiatoolbox.__version__)
import openslide
print("openslide:", openslide.__version__)
import torch
print("torch:", torch.__version__)
EOF
- name: Test Imports (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
conda activate test-env
@"
import tiatoolbox
print("tiatoolbox:", tiatoolbox.__version__)
import openslide
print("openslide:", openslide.__version__)
import torch
print("torch:", torch.__version__)
"@ | python -