diff --git a/README.md b/README.md index 3a9674e..c76286c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ A [Heroku](https://devcenter.heroku.com/) Buildpack for [Poetry](https://github.com/python-poetry/poetry) users. +> [!WARNING] +> The Heroku Python buildpack [now supports Poetry itself](https://github.com/heroku/heroku-buildpack-python/pull/1682), and so an additional Poetry +> buildpack is no longer required to deploy an app that uses Poetry to Heroku. +> +> As such, this buildpack is deprecated and you should no longer use it. + ## How to use The Python Poetry Buildpack prepares the build to be processed by a Python buildpack such as `heroku/python` by generating `requirements.txt` and `runtime.txt` from `poetry.lock`. With that said, your repo cannot have a `requirements.txt`, it will be exported from Poetry (for `runtime.txt` see below). diff --git a/bin/compile b/bin/compile index 4c11c9b..f593ef0 100755 --- a/bin/compile +++ b/bin/compile @@ -2,6 +2,9 @@ set -euo pipefail +export BUILD_DIR="$1" +export ENV_DIR="$3" + function log() { echo "-----> $*" } @@ -10,8 +13,48 @@ function indent() { sed -e 's/^/ /' } -export BUILD_DIR="$1" -export ENV_DIR="$3" +function warning() { + local ansi_yellow='\033[1;33m' + local ansi_reset='\033[0m' + echo >&2 + while IFS= read -r line; do + echo -e "${ansi_yellow} ! ${line}${ansi_reset}" >&2 + done + echo >&2 +} + +warning <<-'EOF' +Warning: This buildpack is no longer required! + +The Heroku Python buildpack now supports Poetry itself, +and so an additional Poetry buildpack is no longer +required to deploy an app that uses Poetry to Heroku. + +We recommend migrating away from this buildpack, since: +- It is deprecated and no longer being maintained. +- The native Poetry support installs dependencies using + Poetry directly, rather than by exporting them to a + requirements.txt file for use with pip. It also caches + the Poetry install for faster rebuilds. + +To migrate: +1. Run 'heroku buildpacks' to find the exact URL/alias + configured on your app for the Poetry buildpack. +2. Remove the Poetry buildpack using: + 'heroku buildpacks:remove ' + For example: + 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' +3. Create a '.python-version' file in the root of your + repository containing a Python version that matches + the version listed in your 'poetry.lock' under + 'metadata.python-versions'. For syntax, see: + https://devcenter.heroku.com/articles/python-runtimes +4. Commit all changes and deploy your app as normal. + +For more information, see: +https://github.com/moneymeets/python-poetry-buildpack/issues/75 +https://github.com/heroku/heroku-buildpack-python/pull/1682 +EOF BUILDPACK_VARIABLES="DISABLE_POETRY_CREATE_RUNTIME_FILE PYTHON_RUNTIME_VERSION" diff --git a/test/fixtures/compile-exact_version_specifier.stderr.txt b/test/fixtures/compile-exact_version_specifier.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-exact_version_specifier.stderr.txt +++ b/test/fixtures/compile-exact_version_specifier.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-export_dev.stderr.txt b/test/fixtures/compile-export_dev.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-export_dev.stderr.txt +++ b/test/fixtures/compile-export_dev.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-export_params-0.stderr.txt b/test/fixtures/compile-export_params-0.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-export_params-0.stderr.txt +++ b/test/fixtures/compile-export_params-0.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-export_params-1.stderr.txt b/test/fixtures/compile-export_params-1.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-export_params-1.stderr.txt +++ b/test/fixtures/compile-export_params-1.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-force_poetry_version.stderr.txt b/test/fixtures/compile-force_poetry_version.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-force_poetry_version.stderr.txt +++ b/test/fixtures/compile-force_poetry_version.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-force_python_version.stderr.txt b/test/fixtures/compile-force_python_version.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-force_python_version.stderr.txt +++ b/test/fixtures/compile-force_python_version.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-invalid_python_version.stderr.txt b/test/fixtures/compile-invalid_python_version.stderr.txt index 118d72b..a2de17e 100644 --- a/test/fixtures/compile-invalid_python_version.stderr.txt +++ b/test/fixtures/compile-invalid_python_version.stderr.txt @@ -1 +1,33 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + -----> ^3.8 is not valid, please specify an exact Python version (e.g. 3.8.1 or ==3.8.1) in your pyproject.toml (and thus poetry.lock) diff --git a/test/fixtures/compile-no_vars_success.stderr.txt b/test/fixtures/compile-no_vars_success.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-no_vars_success.stderr.txt +++ b/test/fixtures/compile-no_vars_success.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-poetry_version_comment.stderr.txt b/test/fixtures/compile-poetry_version_comment.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-poetry_version_comment.stderr.txt +++ b/test/fixtures/compile-poetry_version_comment.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-sanity-1.stderr.txt b/test/fixtures/compile-sanity-1.stderr.txt index baee1b4..615a572 100644 --- a/test/fixtures/compile-sanity-1.stderr.txt +++ b/test/fixtures/compile-sanity-1.stderr.txt @@ -1 +1 @@ -../bin/compile: line 13: $1: unbound variable +../bin/compile: line 5: $1: unbound variable diff --git a/test/fixtures/compile-sanity-2.stderr.txt b/test/fixtures/compile-sanity-2.stderr.txt index 366a186..c078f6b 100644 --- a/test/fixtures/compile-sanity-2.stderr.txt +++ b/test/fixtures/compile-sanity-2.stderr.txt @@ -1 +1 @@ -../bin/compile: line 14: $3: unbound variable +../bin/compile: line 6: $3: unbound variable diff --git a/test/fixtures/compile-skip_runtime_error.stderr.txt b/test/fixtures/compile-skip_runtime_error.stderr.txt index 09d1f3b..c29ecdc 100644 --- a/test/fixtures/compile-skip_runtime_error.stderr.txt +++ b/test/fixtures/compile-skip_runtime_error.stderr.txt @@ -1 +1,33 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + -----> runtime.txt found, delete this file from your repository! diff --git a/test/fixtures/compile-skip_runtime_success.stderr.txt b/test/fixtures/compile-skip_runtime_success.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-skip_runtime_success.stderr.txt +++ b/test/fixtures/compile-skip_runtime_success.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 + diff --git a/test/fixtures/compile-trailing_space.stderr.txt b/test/fixtures/compile-trailing_space.stderr.txt index e69de29..dbcd23a 100644 --- a/test/fixtures/compile-trailing_space.stderr.txt +++ b/test/fixtures/compile-trailing_space.stderr.txt @@ -0,0 +1,32 @@ + + ! Warning: This buildpack is no longer required! + !  + ! The Heroku Python buildpack now supports Poetry itself, + ! and so an additional Poetry buildpack is no longer + ! required to deploy an app that uses Poetry to Heroku. + !  + ! We recommend migrating away from this buildpack, since: + ! - It is deprecated and no longer being maintained. + ! - The native Poetry support installs dependencies using + ! Poetry directly, rather than by exporting them to a + ! requirements.txt file for use with pip. It also caches + ! the Poetry install for faster rebuilds. + !  + ! To migrate: + ! 1. Run 'heroku buildpacks' to find the exact URL/alias + ! configured on your app for the Poetry buildpack. + ! 2. Remove the Poetry buildpack using: + ! 'heroku buildpacks:remove ' + ! For example: + ! 'heroku buildpacks:remove https://github.com/moneymeets/python-poetry-buildpack.git' + ! 3. Create a '.python-version' file in the root of your + ! repository containing a Python version that matches + ! the version listed in your 'poetry.lock' under + ! 'metadata.python-versions'. For syntax, see: + ! https://devcenter.heroku.com/articles/python-runtimes + ! 4. Commit all changes and deploy your app as normal. + !  + ! For more information, see: + ! https://github.com/moneymeets/python-poetry-buildpack/issues/75 + ! https://github.com/heroku/heroku-buildpack-python/pull/1682 +