This reference documentation offers an in-depth description of the behavior and configuration options of the Paketo Python Buildpack. For explanations of how to use the buildpack for several common use-cases, see the Paketo Python Buildpack How To documentation.
The Python buildpack supports several versions of CPython, as well as tools like Pip and Pipenv. For more details on the specific versions supported in a given buildpack version, see the release notes.
The Python Buildpack sets a few environment variables during the
launch phases of the app lifecycle. The sections below describe each
environment variable and its impact on your app.
environment variable is used to add directories where python will look for
The CPython buildpack sets the
PYTHONPATH value to its installation location,
and the Pip, Pipenv buildpack prepends their
site-packages location to it.
site-packages is the target directory where packages are installed to.
environment variable is used to set the user base directory.
Pipenv Install, and
Conda Env Update
The value of
PYTHONUSERBASE is set to the location where these buildpacks install
the application packages so that it can be consumed by the app source code.
The Python Buildpack sets the default start command
python. This starts the Python
REPL (read-eval-print loop) at launch.
If the application uses
Poetry Run buildpack can also be used
to create a start command from single script defined in the
file. See the
for more details.
The Python Buildpack comes with support for
that lets users set custom start commands easily.
The Python buildpack supports the full software bill of materials (SBOM) in Syft, CycloneDX, and SPDX formats. The Python buildpack also includes limited support for the Paketo-specific SBOM format. This Paketo-specific SBOM format does not include information about the application dependencies.
SBOMs will be generated for applications which leverage
Check out the Access the Software Bill of Materials guide for more information about how to retrieve the SBOM for your Python app image.
Currently the Python buildpack has limited support for generating an SBOM for
applications which leverage
Miniconda. Specifically - in order to generate an
SBOM for a
Miniconda application, applications must vendor their dependencies
in addition to defining them via a
applications that declare their dependencies via a
package-list.txt file but
do not vendor them will result in an empty SBOM. This is due to a limitation in
the upstream SBOM generation library (Syft).
Last modified: July 5, 2022