I need to use a private package from our Azure DevOps Feed. We use Cognite UI to upload zip file which contains handler.py and requirements.txt. If I deploy using cognite-sdk then I get additional arguments like in this link : https://docs.cognite.com/cdf/functions/#additional-arguments
which I can use in client.functions.create()
So I have options:
-
index_url
(string): A URL pointing to a different package repository. It supports basic HTTP authentication.
extra_index_urls
(list): A list of URLs pointing to additional python package repositories. Supports basic HTTP authentication.
Using any of these approach I can point to my azure feed(however I am not sure about authentication part. how to provide PAT)
However, when I am using Cognite UI to deploy functions via zip files I dont get options to provide index_urls

So I tried including whl file of our private package within zipped folder and deploy the function. But I got this error:
Message: Function deployment failed.
Trace:
Failed to publish code:
Source directory : /tmp/zipdeploy/extracted
Destination directory: /home/site/wwwroot
Python Version: /tmp/oryx/platforms/python/3.11.11/bin/python3.11
Creating directory for command manifest file if it does not exist
Removing existing manifest file
Running pip install...
Done in 0 sec(s).
WARNING: Requirement './my_sdk-0.0.1rc140425-py3-none-any.whl' looks like a filename, but the file does not exist
s12:54:43+0000] Processing ./my_sdk-0.0.1rc140425-py3-none-any.whl
ERROR: Could not install packages due to an OSError: OErrno 2] No such file or directory: '/tmp/zipdeploy/extracted/my_sdk-0.0.1rc140425-py3-none-any.whl'
WARNING: You are using pip version 21.2.4; however, version 25.0.1 is available.
You should consider upgrading via the '/tmp/oryx/platforms/python/3.11.11/bin/python3.11 -m pip install --upgrade pip' command.
"2025-04-14 12:54:43"|ERROR|WARNING: Requirement './my_sdk-0.0.1rc140425-py3-none-any.whl' looks like a filename, but the file does not exist
s12:54:43+0000] Processing ./my_sdk-0.0.1rc140425-py3-none-any.whl
ERROR: Could not install packages due to an OSError: OErrno 2] No such file or directory: '/tmp/zipdeploy/extracted/my_sdk-0.0.1rc140425-py3-none-any.whl'
WARNING: You are using pip version 21.2.4; however, version 25.0.1 is available.
You should consider upgrading via the '/tmp/oryx/platforms/python/3.11.11/bin/python3.11 -m pip install --upgrade pip' command. | Exit code: 1 | Please review your requirements.txt | More information: https://aka.ms/troubleshoot-python
\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.11 -p packagedir=.python_packages/lib/site-packages
Generating summary of Oryx build
Deployment Log file does not exist in /tmp/oryx-build.log
The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
Deployment Failed. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Ex
I have tried following references:
Course: https://learn.cognite.com/cognite-functions
Documentation: https://docs.cognite.com/cdf/functions
Github: https://github.com/cognitedata/learn-cognite-functions/blob/main/notebooks/Part%201%20-%20Calculating%20the%20thermal%20resistance.ipynb
However, I did not get good references to deploy function.
my zip file contains:
handler.py # this has handle method
requirements.txt # this has path to whl file, in this case ./my_sdk-0.0.1rc140425-py3-none-any.whl
./my_sdk-0.0.1rc140425-py3-none-any.whl # whl file itself