Merge pull request #9680 from freqtrade/ci_py12

Ci py12
This commit is contained in:
Matthias
2024-01-14 19:26:22 +01:00
committed by GitHub
5 changed files with 20 additions and 16 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-20.04, ubuntu-22.04 ] 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -125,7 +125,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ "macos-latest", "macos-13" ] os: [ "macos-latest", "macos-13" ]
python-version: ["3.9", "3.10", "3.11"] python-version: ["3.9", "3.10", "3.11", "3.12"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -238,7 +238,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ windows-latest ] os: [ windows-latest ]
python-version: ["3.9", "3.10", "3.11"] python-version: ["3.9", "3.10", "3.11", "3.12"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+4 -4
View File
@@ -2,10 +2,10 @@
-r requirements-freqai.txt -r requirements-freqai.txt
# Required for freqai-rl # 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 #until these branches will be released we can use this
gymnasium==0.29.1 gymnasium==0.29.1; python_version < '3.12'
stable_baselines3==2.2.1 stable_baselines3==2.2.1; python_version < '3.12'
sb3_contrib>=2.0.0a9 sb3_contrib>=2.0.0a9; python_version < '3.12'
# Progress bar for stable-baselines3 and sb3-contrib # Progress bar for stable-baselines3 and sb3-contrib
tqdm==4.66.1 tqdm==4.66.1
+1 -1
View File
@@ -5,7 +5,7 @@
# Required for freqai # Required for freqai
scikit-learn==1.3.2 scikit-learn==1.3.2
joblib==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 lightgbm==4.2.0
xgboost==2.0.3 xgboost==2.0.3
tensorboard==2.15.1 tensorboard==2.15.1
+6 -1
View File
@@ -1,4 +1,5 @@
import platform import platform
import sys
from copy import deepcopy from copy import deepcopy
from pathlib import Path from pathlib import Path
from typing import Any, Dict from typing import Any, Dict
@@ -15,6 +16,10 @@ from freqtrade.resolvers.freqaimodel_resolver import FreqaiModelResolver
from tests.conftest import get_patched_exchange from tests.conftest import get_patched_exchange
def is_py12() -> bool:
return sys.version_info >= (3, 12)
def is_mac() -> bool: def is_mac() -> bool:
machine = platform.system() machine = platform.system()
return "Darwin" in machine return "Darwin" in machine
@@ -31,7 +36,7 @@ def patch_torch_initlogs(mocker) -> None:
module_name = 'torch' module_name = 'torch'
mocked_module = types.ModuleType(module_name) mocked_module = types.ModuleType(module_name)
sys.modules[module_name] = mocked_module sys.modules[module_name] = mocked_module
else: elif not is_py12():
mocker.patch("torch._logging._init_logs") mocker.patch("torch._logging._init_logs")
+6 -7
View File
@@ -1,7 +1,6 @@
import logging import logging
import platform import platform
import shutil import shutil
import sys
from pathlib import Path from pathlib import Path
from unittest.mock import MagicMock from unittest.mock import MagicMock
@@ -16,24 +15,24 @@ from freqtrade.optimize.backtesting import Backtesting
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.plugins.pairlistmanager import PairListManager from freqtrade.plugins.pairlistmanager import PairListManager
from tests.conftest import EXMS, create_mock_trades, get_patched_exchange, log_has_re 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) mock_pytorch_mlp_model_training_parameters)
def is_py12() -> bool:
return sys.version_info >= (3, 12)
def is_arm() -> bool: def is_arm() -> bool:
machine = platform.machine() machine = platform.machine()
return "arm" in machine or "aarch64" in machine return "arm" in machine or "aarch64" in machine
def can_run_model(model: str) -> None: 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: if is_arm() and "Catboost" in model:
pytest.skip("CatBoost is not supported on ARM.") 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(): if is_pytorch_model and is_mac() and not is_arm():
pytest.skip("Reinforcement learning / PyTorch module not available on intel based Mac OS.") pytest.skip("Reinforcement learning / PyTorch module not available on intel based Mac OS.")