diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d1df9a05..3e3ee9794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: os: [ ubuntu-20.04, ubuntu-22.04 ] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -125,7 +125,7 @@ jobs: strategy: matrix: os: [ "macos-latest", "macos-13" ] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -238,7 +238,7 @@ jobs: strategy: matrix: os: [ windows-latest ] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index 55a09e6f9..fa5e9f014 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -2,10 +2,10 @@ -r requirements-freqai.txt # Required for freqai-rl -torch==2.1.2 +torch==2.1.2; python_version < '3.12' #until these branches will be released we can use this -gymnasium==0.29.1 -stable_baselines3==2.2.1 -sb3_contrib>=2.0.0a9 +gymnasium==0.29.1; python_version < '3.12' +stable_baselines3==2.2.1; python_version < '3.12' +sb3_contrib>=2.0.0a9; python_version < '3.12' # Progress bar for stable-baselines3 and sb3-contrib tqdm==4.66.1 diff --git a/requirements-freqai.txt b/requirements-freqai.txt index 88f3da0a9..17087d8ca 100644 --- a/requirements-freqai.txt +++ b/requirements-freqai.txt @@ -5,7 +5,7 @@ # Required for freqai scikit-learn==1.3.2 joblib==1.3.2 -catboost==1.2.2; 'arm' not in platform_machine +catboost==1.2.2; 'arm' not in platform_machine and python_version < '3.12' lightgbm==4.2.0 xgboost==2.0.3 tensorboard==2.15.1 diff --git a/tests/freqai/conftest.py b/tests/freqai/conftest.py index 57ba3f64b..81d72d92a 100644 --- a/tests/freqai/conftest.py +++ b/tests/freqai/conftest.py @@ -1,4 +1,5 @@ import platform +import sys from copy import deepcopy from pathlib import Path from typing import Any, Dict @@ -15,6 +16,10 @@ from freqtrade.resolvers.freqaimodel_resolver import FreqaiModelResolver from tests.conftest import get_patched_exchange +def is_py12() -> bool: + return sys.version_info >= (3, 12) + + def is_mac() -> bool: machine = platform.system() return "Darwin" in machine @@ -31,7 +36,7 @@ def patch_torch_initlogs(mocker) -> None: module_name = 'torch' mocked_module = types.ModuleType(module_name) sys.modules[module_name] = mocked_module - else: + elif not is_py12(): mocker.patch("torch._logging._init_logs") diff --git a/tests/freqai/test_freqai_interface.py b/tests/freqai/test_freqai_interface.py index cc5a9b326..58648d97f 100644 --- a/tests/freqai/test_freqai_interface.py +++ b/tests/freqai/test_freqai_interface.py @@ -1,7 +1,6 @@ import logging import platform import shutil -import sys from pathlib import Path from unittest.mock import MagicMock @@ -16,24 +15,24 @@ from freqtrade.optimize.backtesting import Backtesting from freqtrade.persistence import Trade from freqtrade.plugins.pairlistmanager import PairListManager from tests.conftest import EXMS, create_mock_trades, get_patched_exchange, log_has_re -from tests.freqai.conftest import (get_patched_freqai_strategy, is_mac, make_rl_config, +from tests.freqai.conftest import (get_patched_freqai_strategy, is_mac, is_py12, make_rl_config, mock_pytorch_mlp_model_training_parameters) -def is_py12() -> bool: - return sys.version_info >= (3, 12) - - def is_arm() -> bool: machine = platform.machine() return "arm" in machine or "aarch64" in machine def can_run_model(model: str) -> None: + is_pytorch_model = 'Reinforcement' in model or 'PyTorch' in model + + if is_py12() and ("Catboost" in model or is_pytorch_model): + pytest.skip("Model not supported on python 3.12 yet.") + if is_arm() and "Catboost" in model: pytest.skip("CatBoost is not supported on ARM.") - is_pytorch_model = 'Reinforcement' in model or 'PyTorch' in model if is_pytorch_model and is_mac() and not is_arm(): pytest.skip("Reinforcement learning / PyTorch module not available on intel based Mac OS.")