The Paketo Buildpack for Poetry is a Cloud Native Buildpack that installs Poetry into a
layer and places it on the PATH
.
The buildpack is published for consumption at gcr.io/paketo-buildpacks/poetry
and
paketobuildpacks/poetry
.
- Detects when
pyproject.toml
exists. - Provides
poetry
. - Always requires
cpython
andpip
. - Optionally requires
poetry
whenBP_POETRY_VERSION
is set.
- Contributes the
poetry
binary to a layer - Prepends the
poetry
layer to thePYTHONPATH
environment variable - Adds the newly installed
poetry
location to thePATH
environment variable
Environment Variable | Description |
---|---|
$BP_POETRY_VERSION |
Configure the version of Poetry to install. Buildpack releases (and the Poetry versions for each release) can be found here. |
The Poetry CNB provides Poetry as a dependency. Downstream buildpacks can require the Poetry dependency by generating a Build Plan TOML file that looks like the following:
[[requires]]
# The name of the Poetry dependency is "poetry". This value is considered
# part of the public API for the buildpack and will not change without a plan
# for deprecation.
name = "poetry"
# The Poetry buildpack supports some non-required metadata options.
[requires.metadata]
# Optional.
# When not specified, the buildpack will select the latest supported version from buildpack.toml
# This buildpack only supports exact version numbers.
version = "21.0.1"
# Set to true to ensure that `poetry` is avilable on both `$PATH` and `$PYTHONPATH` for subsequent buildpacks.
build = true
# Set to true to ensure that `poetry` is avilable on both `$PATH` and `$PYTHONPATH` for the launch container.
launch = true
To package this buildpack for consumption:
$ ./scripts/package.sh --version x.x.x
This will create a buildpackage.cnb
file under the build directory which you
can use to build your app as follows:
pack build <app-name> \
--path <path-to-app> \
--buildpack build/buildpackage.cnb \
--buildpack <other-buildpacks..>
To run the unit and integration tests for this buildpack:
$ ./scripts/unit.sh && ./scripts/integration.sh
- This buildpack does not work in an offline/air-gapped environment; it
requires internet access to install
poetry
. The impact of this limitation is mitigated by the fact thatpoetry
itself does not support vendoring of dependencies, and so cannot function in an offline/air-gapped environment.