Python Dependencies Basics
Motivation
I need to replace Packer template with boto3 code that will replicate its functionality. The reason is that Packer license is confusing.
The Hive Python project is used to create a custom AMI image from a base image. The image will be made public and copied to all AWS regions. Anyone will be able to use the custom image for their own purposes for free.
OpenTofu template will use the custom AMI and provision the infrastructure on AWS for Rails 7.1 app.
Introduction
Using a requirements.txt
file to install dependencies for your Python project is a best practice. This file has the project dependencies in a human readable format that can be installed using pip
, Python’s package installer.
Specify Requirements
- Create a file named
requirements.txt
in your project’s root directory.
The latest version of boto3 can be found at boto3 versions.
Install Dependencies
- Install the dependencies using
pip
:
This command will install boto3
and any other dependencies listed in your requirements.txt
file. This approach ensures that your project’s environment is reproducible, making it easier for others to set up the project and for you to manage dependencies.
Verify Installation
- To check the version installed:
You can also use pip to check the version: