Skip to content

Commit 04fea4a

Browse files
committed
Merge branch 'develop' into maint/python_3.14
2 parents b689926 + 896250f commit 04fea4a

File tree

10 files changed

+106
-10
lines changed

10 files changed

+106
-10
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ jobs:
8787
rm -rf codecov codecov.SHA256SUM codecov.SHA256SUM.sig
8888
8989
- name: Run json schema extract
90-
# This should be kept before the repository check to ensure that the schema is up-to-date
90+
# This must be kept before the repository check to ensure that the schema is up-to-date
9191
run: |
9292
python build_helpers/extract_config_json_schema.py
9393
9494
- name: Run command docs partials extract
95-
# This should be kept before the repository check to ensure that the docs are up-to-date
95+
# This must be kept before the repository check to ensure that the docs are up-to-date
9696
if: ${{ (matrix.python-version == '3.13') }}
9797
run: |
9898
python build_helpers/create_command_partials.py
@@ -159,6 +159,7 @@ jobs:
159159
shell: powershell
160160
run: |
161161
$PSVersionTable
162+
Get-PSRepository | Format-List *
162163
Set-PSRepository psgallery -InstallationPolicy trusted
163164
Install-Module -Name Pester -RequiredVersion 5.3.1 -Confirm:$false -Force -SkipPublisherCheck
164165
$Error.clear()

.github/workflows/docker-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ jobs:
290290
docker buildx imagetools create \
291291
--tag ${GHCR_IMAGE_NAME}:${TAG} \
292292
--tag ${GHCR_IMAGE_NAME}:latest \
293+
--tag ${IMAGE_NAME}:latest \
293294
${IMAGE_NAME}:${TAG}
294295
295296
- name: Docker images

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.13.8-slim-bookworm AS base
1+
FROM python:3.13.11-slim-bookworm AS base
22

33
# Setup env
44
ENV LANG=C.UTF-8

docker/Dockerfile.armhf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11.13-slim-bookworm AS base
1+
FROM python:3.11.14-slim-bookworm AS base
22

33
# Setup env
44
ENV LANG=C.UTF-8

freqtrade/exchange/exchange.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,19 +879,20 @@ def validate_required_startup_candles(self, startup_candles: int, timeframe: str
879879
# Only allow 5 calls per pair to somewhat limit the impact
880880
raise ConfigurationError(
881881
f"This strategy requires {startup_candles} candles to start, "
882-
"which is more than 5x "
882+
f"which is more than 5x ({candle_limit * 5 - 1} candles) "
883883
f"the amount of candles {self.name} provides for {timeframe}."
884884
)
885885
elif required_candle_call_count > 1:
886886
raise ConfigurationError(
887-
f"This strategy requires {startup_candles} candles to start, which is more than "
887+
f"This strategy requires {startup_candles} candles to start, "
888+
f"which is more than ({candle_limit - 1} candles) "
888889
f"the amount of candles {self.name} provides for {timeframe}."
889890
)
890891
if required_candle_call_count > 1:
891892
logger.warning(
892893
f"Using {required_candle_call_count} calls to get OHLCV. "
893894
f"This can result in slower operations for the bot. Please check "
894-
f"if you really need {startup_candles} candles for your strategy"
895+
f"if you really need {startup_candles} candles for your strategy."
895896
)
896897
return required_candle_call_count
897898

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ types-filelock==3.2.7
3030
types-requests==2.32.4.20250913
3131
types-tabulate==0.9.0.20241207
3232
types-python-dateutil==2.9.0.20251115
33+
pip-audit==2.10.0

requirements-freqai.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-r requirements-plot.txt
44

55
# Required for freqai
6-
scikit-learn==1.7.2
6+
scikit-learn==1.8.0
77
joblib==1.5.3
88
lightgbm==4.6.0
99
xgboost==3.1.2

requirements-hyperopt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Required for hyperopt
55
scipy==1.16.3
6-
scikit-learn==1.7.2
6+
scikit-learn==1.8.0
77
filelock==3.20.1
88
optuna==4.6.0
99
cmaes==0.12.0

tests/exchange/test_exchange.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def test_validate_required_startup_candles(default_conf, mocker, caplog):
10121012
ex._ft_has["ohlcv_has_history"] = False
10131013
with pytest.raises(
10141014
OperationalException,
1015-
match=r"This strategy requires 2500.*, " r"which is more than the amount.*",
1015+
match=r"This strategy requires 2500.*, " r"which is more than .* the amount",
10161016
):
10171017
ex.validate_required_startup_candles(2500, "5m")
10181018

tests/test_pip_audit.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""
2+
Run pip audit to check for known security vulnerabilities in installed packages.
3+
Original Idea and base for this implementation by Michael Kennedy's blog:
4+
https://mkennedy.codes/posts/python-supply-chain-security-made-easy/
5+
"""
6+
7+
import subprocess
8+
import sys
9+
from pathlib import Path
10+
11+
import pytest
12+
13+
14+
def test_pip_audit_no_vulnerabilities():
15+
"""
16+
Run pip-audit to check for known security vulnerabilities.
17+
18+
This test will fail if any vulnerabilities are detected in the installed packages.
19+
20+
Note: CVE-2025-53000 (nbconvert Windows vulnerability) is ignored as it only affects
21+
Windows platforms and is a known acceptable risk for this project.
22+
"""
23+
# Get the project root directory
24+
project_root = Path(__file__).parent.parent
25+
command = [
26+
sys.executable,
27+
"-m",
28+
"pip_audit",
29+
# "--format=json",
30+
"--progress-spinner=off",
31+
"--ignore-vuln",
32+
"CVE-2025-53000",
33+
"--skip-editable",
34+
]
35+
36+
# Run pip-audit with JSON output for easier parsing
37+
try:
38+
result = subprocess.run(
39+
command,
40+
cwd=project_root,
41+
capture_output=True,
42+
text=True,
43+
timeout=120, # 2 minute timeout
44+
)
45+
except subprocess.TimeoutExpired:
46+
pytest.fail("pip-audit command timed out after 120 seconds")
47+
except FileNotFoundError:
48+
pytest.fail("pip-audit not installed or not accessible")
49+
50+
# Check if pip-audit found any vulnerabilities
51+
if result.returncode != 0:
52+
# pip-audit returns non-zero when vulnerabilities are found
53+
error_output = result.stdout + "\n" + result.stderr
54+
55+
# Check if it's an actual vulnerability vs an error
56+
if "vulnerabilities found" in error_output.lower() or '"dependencies"' in result.stdout:
57+
pytest.fail(
58+
f"pip-audit detected security vulnerabilities!\n\n"
59+
f"Output:\n{result.stdout}\n\n"
60+
f"Please review and update vulnerable packages.\n"
61+
f"Run manually with: {' '.join(command)}"
62+
)
63+
else:
64+
# Some other error occurred
65+
pytest.fail(
66+
f"pip-audit failed to run properly:\n\nReturn code: {result.returncode}\n"
67+
f"Output: {error_output}\n"
68+
)
69+
70+
# Success - no vulnerabilities found
71+
assert result.returncode == 0, "pip-audit should return 0 when no vulnerabilities are found"
72+
73+
74+
def test_pip_audit_runs_successfully():
75+
"""
76+
Verify that pip-audit can run successfully (even if vulnerabilities are found).
77+
78+
This is a smoke test to ensure pip-audit is properly installed and functional.
79+
"""
80+
try:
81+
result = subprocess.run(
82+
[sys.executable, "-m", "pip_audit", "--version"],
83+
capture_output=True,
84+
text=True,
85+
timeout=10,
86+
)
87+
assert result.returncode == 0, f"pip-audit --version failed: {result.stderr}"
88+
assert "pip-audit" in result.stdout.lower(), "pip-audit version output unexpected"
89+
except FileNotFoundError:
90+
pytest.fail("pip-audit not installed")
91+
except subprocess.TimeoutExpired:
92+
pytest.fail("pip-audit --version timed out")

0 commit comments

Comments
 (0)