heroku/python
is the Heroku Cloud Native Buildpack
for Python applications. It builds Python application source code into application images with
minimal configuration.
Important
This is a Cloud Native Buildpack, and is a component of the Heroku Cloud Native Buildpacks project, which is in preview. If you are instead looking for the Heroku Classic Buildpack for Python (for use on the Heroku platform), you may find it here.
Note
Before getting started, ensure you have the pack
CLI installed. Installation instructions are available here.
To build a Python application codebase into a production image:
$ cd ~/workdir/sample-python-app
$ pack build sample-app --builder heroku/builder:24
Then run the image:
docker run --rm -it -e "PORT=8080" -p 8080:8080 sample-app
A requirements.txt
or poetry.lock
file must be present in the root (top-level) directory of your app's source code.
By default, the buildpack will install the latest version of Python 3.13.
To install a different version, add a .python-version
file to your app's root directory that declares the version number to use:
$ cat .python-version
3.13
Issues and pull requests are welcome. See our contributing guidelines if you would like to help.