Finds the currently supported (i.e., non-EOL) versions of Python. This ensures that CI workflows will automatically test Python code on supported versions, without requiring manual reconfiguration to add new versions or remove EOL versions.
which- Which supported versions to obtain. This can belatest(default),oldestorall.when- The date to use for determining supported versions. This should follow aYYYY-MM-DDformat. Defaults to an empty string, which will use the current date.
version- The requested version. Forlatestoroldest, this is a single string specifying the version. Forall, it is a string containing a JSON array of versions sorted from latest to oldest.
Switch between the latest and oldest supported Python versions:
name: Using most extreme supported Pythons
on: push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
which-python: [ 'latest', 'oldest' ]
steps:
- uses: actions/checkout@v7
- uses: BiocPy/find-supported-python@v1
id: find-version
with:
which: ${{ matrix.which-python }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ steps.find-version.outputs.version }}Use all currently supported Python versions:
name: Using all supported Pythons
jobs:
find:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.find-version.outputs.version }}
steps:
- uses: BiocPy/find-supported-python@v1
id: find-version
with:
which: 'all'
build:
runs-on: ubuntu-latest
needs: find
strategy:
matrix:
version: ${{ fromJSON(needs.find.outputs.version) }}
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}