question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating the deployment package (BYOF)

See original GitHub issue

bring-your-own-files

To deploy Python functions to Azure along with the required dependencies, follow the steps below.

Note: If the only dependencies are other user defined modules already contained in the functionapp directory, no action is required. Please make sure to reference these modules correctly in your code.

1. Generate the requirements manifest

The requirements.txt file must contain a list of all packages required to execute your function code. Use the pip freeze utility to capture the exact version of everything that is installed in your development environment.

pip freeze > requirements.txt

2. Build wheel archives

Wheel is a built-package format, and offers the advantage of not recompiling your software during every install. Build a directory of wheels for all dependencies in requirements.txt.

# Install the wheel utility
pip install wheel

# Download to wheels subdirectory
pip wheel --wheel-dir=/functionapp/wheels -r requirements.txt

Serverside workflow

To ensure that your packages are available in the production environment in Azure, we will run pip install on the wheels folder using the command below:

pip install --no-index --find-links=/functionapp/wheels -r requirements.txt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
monty-devcommented, Feb 16, 2018

Option 3 that might want to be advertised is creating a deployment package. Instead of using pip to install packages on the Function app, one could configure their app to install libraries in the root of their project with something like pip install requests -t /path/to/project ZIP, upload project dir to wwwroot or FTP. This could be an easier approach in a CI/CD type workflow.

1reaction
elpranscommented, Apr 11, 2018

@asavaritayal The only correct way to make a package available is to pip install it into the correct virtual env. Thus, the host, upon unzipping the artifact should run pip install on the folder that contains the wheels.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating your deployment package - Google Cloud
Deployment Manager enables you to create deployment packages for your VM products by using simple YAML, JSON, or ProtoText configuration files.
Read more >
Create a Deployment Package - Configuration Manager
You create a software updates deployment package, in Configuration Manager, by creating an instance of the SMS_SoftwareUpdatesPackage class ...
Read more >
Create a Deployment Package - SmartDeploy Support Center
Follow this visual step-by-step guide to successfully create a Deployment Package for use with console-initiated deployments from the SmartDeploy Console.
Read more >
Lambda deployment packages - AWS Documentation
Use a deployment package to deploy your Lambda function code. Lambda supports two types of deployment packages: container images and .zip file archives....
Read more >
Lesson 2.1: Creating deployment packages - IBM
Open the Package window by selecting a domain to which you are connected in the Repository tree and doing one of the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found