From f533844546cde9c0f2fd2eddcfe7dd664efc25e0 Mon Sep 17 00:00:00 2001 From: DDiyash Date: Sun, 28 Dec 2025 10:53:51 +0530 Subject: [PATCH] Update Python version support and CI to include Python 3.14 --- .github/workflows/dist.yaml | 2 +- .github/workflows/docs.yaml | 2 +- .github/workflows/test.yml | 209 +++++++++++++++++++----------------- .gitignore | 12 ++- README.md | 4 +- pyproject.toml | 8 +- 6 files changed, 127 insertions(+), 110 deletions(-) diff --git a/.github/workflows/dist.yaml b/.github/workflows/dist.yaml index b81651cea..4baf637de 100644 --- a/.github/workflows/dist.yaml +++ b/.github/workflows/dist.yaml @@ -27,7 +27,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.10 - name: Build dist run: | pip install build diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index b583b6423..91051649f 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -28,7 +28,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.10 - name: Install dependencies run: | pip install -e .[docs,examples] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 31cdff602..4d2a9ff59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +--- name: Tests on: @@ -21,117 +22,125 @@ concurrency: jobs: test: - name: (${{ matrix.os }}, Py${{ matrix.python-version }}, sk${{ matrix.scikit-learn }}, sk-only:${{ matrix.sklearn-only }}) + name: (${{ matrix.os }},Py${{ matrix.python-version }},sk${{ matrix.scikit-learn }},sk-only:${{ matrix.sklearn-only }}) runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: ["3.9"] - scikit-learn: ["1.0.*", "1.1.*", "1.2.*", "1.3.*", "1.4.*", "1.5.*"] - os: [ubuntu-latest] - sklearn-only: ["true"] include: - os: ubuntu-latest - python-version: "3.8" # no scikit-learn 0.23 release for Python 3.9 - scikit-learn: "0.23.1" - sklearn-only: "true" - # scikit-learn 0.24 relies on scipy defaults, so we need to fix the version - # c.f. https://github.com/openml/openml-python/pull/1267 + python-version: "3.10" + scikit-learn: "1.0.*" + scipy: "1.10.0" + sklearn-only: true - os: ubuntu-latest - python-version: "3.9" - scikit-learn: "0.24" + python-version: "3.11" + scikit-learn: "1.3.*" scipy: "1.10.0" - sklearn-only: "true" - # Do a Windows and Ubuntu test for _all_ openml functionality - # I am not sure why these are on 3.8 and older scikit-learn + sklearn-only: true + - os: ubuntu-latest + python-version: "3.12" + scikit-learn: "1.5.*" + scipy: ">=1.11" + sklearn-only: true + - os: ubuntu-latest + python-version: "3.13" + scikit-learn: "1.6.*" + scipy: ">=1.10" + sklearn-only: true + - os: ubuntu-latest + python-version: "3.14" + scikit-learn: "1.7.*" + scipy: ">=1.10" + sklearn-only: true - os: windows-latest - python-version: "3.8" - scikit-learn: 0.24.* - scipy: "1.10.0" - sklearn-only: 'false' - # Include a code cov version + python-version: "3.10" + scikit-learn: "1.5.*" + scipy: "1.10.1" + sklearn-only: false + - os: windows-latest + python-version: "3.13" + scikit-learn: "1.6.*" + scipy: ">=1.10" + sklearn-only: false - os: ubuntu-latest - code-cov: true - python-version: "3.8" - scikit-learn: 0.23.1 - sklearn-only: 'false' - fail-fast: false - + code-cov: false + python-version: "3.10" + scikit-learn: "1.5.*" + scipy: ">=1.10" + sklearn-only: false steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Setup Python ${{ matrix.python-version }} - if: matrix.os != 'windows-latest' # windows-latest only uses preinstalled Python (3.9.13) - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install test dependencies - run: | - python -m pip install --upgrade pip - pip install -e .[test] - - name: Install scikit-learn ${{ matrix.scikit-learn }} - run: | - pip install scikit-learn==${{ matrix.scikit-learn }} - - name: Install numpy for Python 3.8 - # Python 3.8 & scikit-learn<0.24 requires numpy<=1.23.5 - if: ${{ matrix.python-version == '3.8' && matrix.scikit-learn == '0.23.1' }} - run: | - pip install numpy==1.23.5 - - name: "Install NumPy 1.x and SciPy <1.11 for scikit-learn < 1.4" - if: ${{ contains(fromJSON('["1.0.*", "1.1.*", "1.2.*", "1.3.*"]'), matrix.scikit-learn) }} - run: | - # scipy has a change to the 'mode' behavior which breaks scikit-learn < 1.4 - # numpy 2.0 has several breaking changes - pip install "numpy<2.0" "scipy<1.11" - - name: Install scipy ${{ matrix.scipy }} - if: ${{ matrix.scipy }} - run: | - pip install scipy==${{ matrix.scipy }} - - name: Store repository status - id: status-before - if: matrix.os != 'windows-latest' - run: | - git_status=$(git status --porcelain -b) - echo "BEFORE=$git_status" >> $GITHUB_ENV - echo "Repository status before tests: $git_status" - - name: Show installed dependencies - run: python -m pip list - - name: Run tests on Ubuntu Test - if: matrix.os == 'ubuntu-latest' - run: | - if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi - # Most of the time, running only the scikit-learn tests is sufficient - if [ ${{ matrix.sklearn-only }} = 'true' ]; then marks='sklearn and not production'; else marks='not production'; fi - echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" - pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" - - name: Run tests on Ubuntu Production - if: matrix.os == 'ubuntu-latest' - run: | - if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi - # Most of the time, running only the scikit-learn tests is sufficient - if [ ${{ matrix.sklearn-only }} = 'true' ]; then marks='sklearn and production'; else marks='production'; fi - echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" - pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" - - name: Run tests on Windows - if: matrix.os == 'windows-latest' - run: | # we need a separate step because of the bash-specific if-statement in the previous one. - pytest -n 4 --durations=20 --dist load -sv --reruns 5 --reruns-delay 1 - - name: Check for files left behind by test - if: matrix.os != 'windows-latest' && always() - run: | - before="${{ env.BEFORE }}" - after="$(git status --porcelain -b)" - if [[ "$before" != "$after" ]]; then + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + allow-prereleases: true + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[test] + - name: Install scikit-learn ${{ matrix.scikit-learn }} + run: | + pip install scikit-learn==${{ matrix.scikit-learn }} + - name: "Install NumPy 1.x and SciPy <1.11 for scikit-learn < 1.4" + if: ${{ contains(fromJSON('["1.0.*", "1.1.*", "1.2.*", "1.3.*"]'), matrix.scikit-learn) }} + shell: bash + run: | + # scipy has a change to the 'mode' behavior which breaks scikit-learn < 1.4 + # numpy 2.0 has several breaking changes + pip install "numpy<2.0" "scipy<1.11" + - name: Install scipy ${{ matrix.scipy }} + if: ${{ matrix.scipy }} + run: | + pip install scipy${{ matrix.scipy }} + - name: Store repository status + id: status-before + if: matrix.os != 'windows-latest' + run: | + git_status=$(git status --porcelain -b) + echo "BEFORE=$git_status" >> $GITHUB_ENV + echo "Repository status before tests: $git_status" + - name: Show installed dependencies + run: python -m pip list + - name: Run tests on Ubuntu Test + if: matrix.os == 'ubuntu-latest' + run: | + if [ "${{ matrix.code-cov }}" = "true" ]; then codecov='--cov=openml --long --cov-report=xml'; fi + # Most of the time, running only the scikit-learn tests is sufficient + if [ "${{ matrix.sklearn-only }}" = "true" ]; then marks='sklearn and not production'; else marks='not production'; fi + echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" + pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" + - name: Run tests on Ubuntu Production + if: matrix.os == 'ubuntu-latest' + run: | + if [ "${{ matrix.code-cov }}" = "true" ]; then codecov='--cov=openml --long --cov-report=xml'; fi + # Most of the time, running only the scikit-learn tests is sufficient + if [ "${{ matrix.sklearn-only }}" = "true" ]; then marks='sklearn and production'; else marks='production'; fi + echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" + pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks" + - name: Run tests on Windows + if: matrix.os == 'windows-latest' + run: | + pytest -n 4 --durations=20 --dist load -sv --reruns 5 --reruns-delay 1 + - name: Check for files left behind by test + if: matrix.os != 'windows-latest' && always() + run: | + before="${{ env.BEFORE }}" + after="$(git status --porcelain -b)" + if [[ "$before" != "$after" ]]; then echo "git status from before: $before" echo "git status from after: $after" echo "Not all generated files have been deleted!" exit 1 - fi - - name: Upload coverage - if: matrix.code-cov && always() - uses: codecov/codecov-action@v4 - with: - files: coverage.xml - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - verbose: true + fi + - name: Upload coverage + if: matrix.code-cov && always() + uses: codecov/codecov-action@v4 + with: + files: coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true diff --git a/.gitignore b/.gitignore index 132070bf3..001662890 100644 --- a/.gitignore +++ b/.gitignore @@ -96,4 +96,14 @@ dmypy.sock # Tests .pytest_cache -.venv \ No newline at end of file +.venv + +# Virtual environments +oenv/ +venv/ +.env/ +.venv/ + +# Python cache +__pycache__/ +*.pyc diff --git a/README.md b/README.md index e8df97ad6..c44e42981 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ## The Python API for a World of Data and More :dizzy: [![Latest Release](https://img.shields.io/github/v/release/openml/openml-python)](https://github.com/openml/openml-python/releases) -[![Python Versions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://pypi.org/project/openml/) +[![Python Versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue)](https://pypi.org/project/openml/) [![Downloads](https://static.pepy.tech/badge/openml)](https://pepy.tech/project/openml) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) @@ -60,7 +60,7 @@ for task_id in suite.tasks: ## :magic_wand: Installation -OpenML-Python is supported on Python 3.8 - 3.13 and is available on Linux, MacOS, and Windows. +OpenML-Python is supported on Python 3.10 - 3.14 and is available on Linux, MacOS, and Windows. You can install OpenML-Python with: diff --git a/pyproject.toml b/pyproject.toml index 2bf762b09..88a4e7300 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "pyarrow", "tqdm", # For MinIO download progress bars ] -requires-python = ">=3.8" +requires-python = ">=3.10,<3.15" maintainers = [ { name = "Pieter Gijsbers", email="p.gijsbers@tue.nl"}, { name = "Lennart Purucker"}, @@ -49,13 +49,11 @@ classifiers = [ "Operating System :: POSIX", "Operating System :: Unix", "Operating System :: MacOS", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] license = { file = "LICENSE" }