Skip to content

Commit

Permalink
Merge pull request optuna#5018 from not522/python3.12
Browse files Browse the repository at this point in the history
Support Python 3.12 on tests for core modules
  • Loading branch information
HideakiImamura authored Nov 2, 2023
2 parents 31f3715 + 94ccb3b commit f32428e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

services:
redis:
Expand Down Expand Up @@ -74,16 +74,23 @@ jobs:
pip install pipdeptree
pipdeptree
- name: Scheduled tests
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
pytest tests -m "not integration"
env:
SQLALCHEMY_WARN_20: 1

- name: Tests
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
pytest tests -m "not integration and not slow"
if [ "${{ github.event_name }}" = "schedule" ] || \
[ "${{ github.event_name }}" = "workflow_dispatch" ] ; then
target="not integration"
else
target="not integration and not slow"
fi
if [ "${{ matrix.python-version }}" = "3.12" ] ; then
# TODO(not522): Remove ignores when BoTorch supports Python 3.12
ignore_option="--ignore tests/terminator_tests/ \
--ignore tests/visualization_tests/test_terminator_improvement.py"
else
ignore_option=""
fi
pytest tests -m "$target" $ignore_option
env:
SQLALCHEMY_WARN_20: 1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Optuna: A hyperparameter optimization framework

[![Python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)](https://www.python.org)
[![Python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org)
[![pypi](https://img.shields.io/pypi/v/optuna.svg)](https://pypi.python.org/pypi/optuna)
[![conda](https://img.shields.io/conda/vn/conda-forge/optuna.svg)](https://anaconda.org/conda-forge/optuna)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/optuna/optuna)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
Expand Down Expand Up @@ -110,7 +111,7 @@ integration = [
]
optional = [
"boto3", # optuna/artifacts/_boto3.py.
"botorch", # optuna/terminator/gp/botorch.
"botorch; python_version<='3.11'", # optuna/terminator/gp/botorch.
"cmaes>=0.10.0", # optuna/samplers/_cmaes.py.
"google-cloud-storage", # optuna/artifacts/_gcs.py.
"matplotlib!=3.6.0", # optuna/visualization/matplotlib.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_botorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from unittest.mock import patch
import warnings

import botorch
from packaging import version
import pytest

Expand All @@ -22,6 +21,7 @@


with try_import() as _imports:
import botorch
import torch

if not _imports.is_successful():
Expand Down

0 comments on commit f32428e

Please sign in to comment.