Skip to content

Commit 14b5392

Browse files
authored
Merge pull request freqtrade#12420 from qinhanlei/uv-pip
Add support for uv in setup.sh
2 parents c18a52f + 16dd407 commit 14b5392

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The easiest way to install and run Freqtrade is to clone the bot Github reposito
2424
The `stable` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable).
2525

2626
!!! Note
27-
Python3.11 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
27+
Either [uv](https://docs.astral.sh/uv/), or Python3.11 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository.
2828
Also, python headers (`python<yourversion>-dev` / `python<yourversion>-devel`) must be available for the installation to complete successfully.
2929

3030
!!! Warning "Up-to-date clock"

setup.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function echo_block() {
66
echo $1
77
echo "----------------------------"
88
}
9+
UV=false
910

1011
function check_installed_pip() {
1112
${PYTHON} -m pip > /dev/null
@@ -24,6 +25,13 @@ function check_installed_python() {
2425
echo "You can do this by running 'deactivate'."
2526
exit 2
2627
fi
28+
if [ -x "$(command -v uv)" ]; then
29+
echo "uv detected — using it instead of pip for faster installation."
30+
PIP="uv pip"
31+
PYTHON="python3.13"
32+
UV=true
33+
return
34+
fi
2735

2836
for v in 13 12 11
2937
do
@@ -32,6 +40,7 @@ function check_installed_python() {
3240
if [ $? -eq 0 ]; then
3341
echo "using ${PYTHON}"
3442
check_installed_pip
43+
PIP="${PYTHON} -m pip"
3544
return
3645
fi
3746
done
@@ -49,7 +58,7 @@ function updateenv() {
4958
source .venv/bin/activate
5059
SYS_ARCH=$(uname -m)
5160
echo "pip install in-progress. Please wait..."
52-
${PYTHON} -m pip install --upgrade pip wheel setuptools
61+
${PIP} install --upgrade pip wheel setuptools
5362
REQUIREMENTS_HYPEROPT=""
5463
REQUIREMENTS_PLOT=""
5564
REQUIREMENTS_FREQAI=""
@@ -70,7 +79,7 @@ function updateenv() {
7079
fi
7180
if [ "${SYS_ARCH}" == "armv7l" ] || [ "${SYS_ARCH}" == "armv6l" ]; then
7281
echo "Detected Raspberry, installing cython, skipping hyperopt installation."
73-
${PYTHON} -m pip install --upgrade cython
82+
${PIP} install --upgrade cython
7483
else
7584
# Is not Raspberry
7685
read -p "Do you want to install hyperopt dependencies [y/N]? "
@@ -92,12 +101,12 @@ function updateenv() {
92101
fi
93102
fi
94103

95-
${PYTHON} -m pip install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT} ${REQUIREMENTS_FREQAI} ${REQUIREMENTS_FREQAI_RL}
104+
${PIP} install --upgrade -r ${REQUIREMENTS} ${REQUIREMENTS_HYPEROPT} ${REQUIREMENTS_PLOT} ${REQUIREMENTS_FREQAI} ${REQUIREMENTS_FREQAI_RL}
96105
if [ $? -ne 0 ]; then
97106
echo "Failed installing dependencies"
98107
exit 1
99108
fi
100-
${PYTHON} -m pip install -e .
109+
${PIP} install -e .
101110
if [ $? -ne 0 ]; then
102111
echo "Failed installing Freqtrade"
103112
exit 1
@@ -179,7 +188,12 @@ function recreate_environments() {
179188
fi
180189

181190
echo
182-
${PYTHON} -m venv .venv
191+
if [ "$UV" = true ] ; then
192+
echo "- Creating new virtual environment with uv"
193+
uv venv .venv --python=${PYTHON}
194+
else
195+
${PYTHON} -m venv .venv
196+
fi
183197
if [ $? -ne 0 ]; then
184198
echo "Could not create virtual environment. Leaving now"
185199
exit 1
@@ -252,7 +266,7 @@ function install() {
252266

253267
function plot() {
254268
echo_block "Installing dependencies for Plotting scripts"
255-
${PYTHON} -m pip install plotly --upgrade
269+
${PIP} install plotly --upgrade
256270
}
257271

258272
function help() {

0 commit comments

Comments
 (0)