diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b2b73c3e..29c88e5c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Updated Poetry from 2.0.1 to 2.1.1. ([#1758](https://github.com/heroku/heroku-buildpack-python/pull/1758)) - Stopped filtering out pip's `Requirement already satisfied:` log lines when installing dependencies. ([#1765](https://github.com/heroku/heroku-buildpack-python/pull/1765)) - Improved the error messages shown if installing pip/Poetry/Pipenv fails. ([#1764](https://github.com/heroku/heroku-buildpack-python/pull/1764)) - Stopped installing pip into Poetry's virtual environment. ([#1761](https://github.com/heroku/heroku-buildpack-python/pull/1761)) diff --git a/lib/poetry.sh b/lib/poetry.sh index 6b4888eea..a453356a1 100644 --- a/lib/poetry.sh +++ b/lib/poetry.sh @@ -101,11 +101,15 @@ function poetry::install_poetry() { export PATH="${poetry_bin_dir}:${PATH}" # Force Poetry to manage the system Python site-packages instead of using venvs. export POETRY_VIRTUALENVS_CREATE="false" + # Force Poetry to use our Python rather than scanning PATH (which might pick system Python). + # Though this currently doesn't work as documented: https://github.com/python-poetry/poetry/issues/10226 + export POETRY_VIRTUALENVS_USE_POETRY_PYTHON="true" # Set the same env vars in the environment used by later buildpacks. cat >>"${export_file}" <<-EOF export PATH="${poetry_bin_dir}:\${PATH}" export POETRY_VIRTUALENVS_CREATE="false" + export POETRY_VIRTUALENVS_USE_POETRY_PYTHON="true" EOF } diff --git a/requirements/poetry.txt b/requirements/poetry.txt index d1c8013e2..f71727796 100644 --- a/requirements/poetry.txt +++ b/requirements/poetry.txt @@ -1 +1 @@ -poetry==2.0.1 +poetry==2.1.1 diff --git a/spec/fixtures/poetry_basic/poetry.lock b/spec/fixtures/poetry_basic/poetry.lock index 7fe5d0794..166f8fea8 100644 --- a/spec/fixtures/poetry_basic/poetry.lock +++ b/spec/fixtures/poetry_basic/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. [[package]] name = "colorama" @@ -6,6 +6,8 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["dev"] +markers = "sys_platform == \"win32\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -17,6 +19,7 @@ version = "2.0.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, @@ -28,6 +31,7 @@ version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, @@ -39,6 +43,7 @@ version = "1.5.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, @@ -54,6 +59,7 @@ version = "8.3.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"}, {file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"}, @@ -74,12 +80,13 @@ version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] [metadata] -lock-version = "2.0" -python-versions = "^3.13" -content-hash = "56ec6342f4a39b402d2b65bd08cfb3af4136a02bb58674df49eac8d317376a7f" +lock-version = "2.1" +python-versions = ">=3.13" +content-hash = "8e82be2391208aa1b8599893f6abec30c0aa5702a846842fd442f50de45481e2" diff --git a/spec/fixtures/poetry_basic/pyproject.toml b/spec/fixtures/poetry_basic/pyproject.toml index 9fc0e8356..85bd48b9d 100644 --- a/spec/fixtures/poetry_basic/pyproject.toml +++ b/spec/fixtures/poetry_basic/pyproject.toml @@ -1,10 +1,14 @@ +[project] +name = "poetry-basic" +version = "0.0.0" +requires-python = ">=3.13" +dependencies = [ + "typing-extensions" +] + [tool.poetry] package-mode = false -[tool.poetry.dependencies] -python = "^3.13" -typing-extensions = "*" - # This group shouldn't be installed due to us passing `--only main`. -[tool.poetry.group.test.dependencies] +[tool.poetry.group.dev.dependencies] pytest = "*" diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 5ff6041be..f11e37a23 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -189,6 +189,7 @@ PIP_NO_PYTHON_VERSION_WARNING=1 PKG_CONFIG_PATH=/app/.heroku/python/lib/pkg-config POETRY_VIRTUALENVS_CREATE=false + POETRY_VIRTUALENVS_USE_POETRY_PYTHON=true PYTHONUNBUFFERED=1 -----> Inline app detected LANG=en_US.UTF-8 @@ -196,6 +197,7 @@ LIBRARY_PATH=/app/.heroku/python/lib PATH=/app/.heroku/python/bin:/tmp/cache.+/.heroku/python-poetry/bin:/usr/local/bin:/usr/bin:/bin:/app/.sprettur/bin/ POETRY_VIRTUALENVS_CREATE=false + POETRY_VIRTUALENVS_USE_POETRY_PYTHON=true PYTHONHASHSEED=random PYTHONHOME=/app/.heroku/python PYTHONPATH=/app diff --git a/spec/hatchet/poetry_spec.rb b/spec/hatchet/poetry_spec.rb index 874715f00..9d8d6c4ac 100644 --- a/spec/hatchet/poetry_spec.rb +++ b/spec/hatchet/poetry_spec.rb @@ -26,6 +26,7 @@ remote: LIBRARY_PATH=/app/.heroku/python/lib remote: PATH=/app/.heroku/python/bin:/tmp/codon/tmp/cache/.heroku/python-poetry/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin remote: POETRY_VIRTUALENVS_CREATE=false + remote: POETRY_VIRTUALENVS_USE_POETRY_PYTHON=true remote: PYTHONHASHSEED=random remote: PYTHONHOME=/app/.heroku/python remote: PYTHONPATH=/app @@ -62,7 +63,7 @@ end context 'when the Poetry and Python versions have changed since the last build' do - let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v274'] } + let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v275'] } let(:app) { Hatchet::Runner.new('spec/fixtures/poetry_basic', buildpacks:) } it 'clears the cache before installing' do @@ -75,7 +76,7 @@ remote: -----> Using Python 3.13 specified in .python-version remote: -----> Discarding cache since: remote: - The Python version has changed from 3.13.1 to #{LATEST_PYTHON_3_13} - remote: - The Poetry version has changed from 1.8.5 to #{POETRY_VERSION} + remote: - The Poetry version has changed from 2.0.1 to #{POETRY_VERSION} remote: -----> Installing Python #{LATEST_PYTHON_3_13} remote: -----> Installing Poetry #{POETRY_VERSION} remote: -----> Installing dependencies using 'poetry sync --only main'