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 paketobuildpacks/poetry.
- Detects when
pyproject.tomlexists. - Provides
poetry. - Always requires
cpythonandpip. - Optionally requires
poetrywhenBP_POETRY_VERSIONis set.
- Contributes the
poetrybinary to a layer - Prepends the
poetrylayer to thePYTHONPATHenvironment variable - Adds the newly installed
poetrylocation to thePATHenvironment 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 = trueTo 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 thatpoetryitself does not support vendoring of dependencies, and so cannot function in an offline/air-gapped environment.