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
commit 31fb06fa80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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.")