Deploying my Python Azure Function to a Function app takes a painful amount of time (sometimes >25 minutes).
The project only consists of 2 timer-trigger functions and the requirements.txt has the following entries:
<code>azure-functions
pyodbc
sqlalchemy
numpy==1.26.4
pandas
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.0+cpu
darts
</code>
<code>azure-functions
pyodbc
sqlalchemy
numpy==1.26.4
pandas
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.0+cpu
darts
</code>
azure-functions
pyodbc
sqlalchemy
numpy==1.26.4
pandas
-f https://download.pytorch.org/whl/torch_stable.html
torch==2.2.0+cpu
darts
From what I can see, the most time is spent on deleting the old .python directory, (re-)installing all pip packages and then copying to the destination directory /home/site/wwwroot.
Is there a way to cache the installed packages, so I don’t have to redeploy everything if I just make slight changes to the code? Are there other ways to speed up the process?