Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix using Poetry with outdated Python patch versions #1687

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Nov 6, 2024

The existing Poetry bootstrap process added in #1682 used the pip wheel bundled within the Python stdlib.

This required use of pip's --python option, which was added to pip in v22.3 in 2022. All of the major Python versions we support have been updated to that pip version or newer, however, the older patch releases of some of those major Python versions can contain pip versions that are older (for example, whilst latest Python 3.9.x bundles pip v23.0.1, Python 3.9.0 bundles pip v20.2.1).

Previously, using those older patch versions would result in:

-----> Installing Poetry 1.8.4

Usage:   
  pip <command> [options]

no such option: --python

 !     Error: Unable to install Poetry.

Whilst we strongly recommend users upgrade to newer patch releases (since older versions are missing security updates and so likely insecure), we still want to support using Poetry on these versions, so the I've adjusted the bootstrap process to no longer use --python to prevent that error.

The existing Poetry bootstrap process added in #1682 used the pip wheel
bundled within the Python stdlib.

This required use of pip's `--python` option, which was added to pip in
v22.3 in 2022. All of the major Python versions we support have been
updated to that pip version or newer, the older patch releases of some
of those major Python versions can contain pip versions that are older.

Whilst we strongly recommend upgrading to newer patch releases (since
older versions are missing security updates and so likely insecure),
we still want to support using Poetry on these versions, so the I've
adjusted the bootstrap process to no longer use `--python`.
@edmorley edmorley added the bug label Nov 6, 2024
@edmorley edmorley self-assigned this Nov 6, 2024
@edmorley edmorley marked this pull request as ready for review November 6, 2024 12:21
@edmorley edmorley requested a review from a team as a code owner November 6, 2024 12:21
@edmorley edmorley enabled auto-merge (squash) November 6, 2024 12:22
@edmorley edmorley disabled auto-merge November 6, 2024 12:24
@edmorley edmorley enabled auto-merge (squash) November 6, 2024 12:24
@edmorley edmorley merged commit b576e23 into main Nov 6, 2024
8 checks passed
@edmorley edmorley deleted the fix-poetry-old-python branch November 6, 2024 13:03
@heroku-linguist heroku-linguist bot mentioned this pull request Nov 6, 2024
edmorley added a commit that referenced this pull request Feb 24, 2025
This is an alternative approach to installing Poetry that means we can
skip installing pip into its virtual environment, but still support
the outdated Python versions which bundle older pip (that don't support
the `--python` option; see #1687) or that don't correctly isolate the
environment when running `ensurepip` (see #1698).

Skipping installing pip speeds up the cold cache build for Poetry
slightly, and also reduces the build cache size (which will help with
the cache save and restore times for warm builds too).

The pip installed in the Poetry venv wasn't exposed to apps (since it
wasn't on `PATH`) so is safe to remove.

GUS-W-17895154.
edmorley added a commit that referenced this pull request Feb 24, 2025
This is an alternative approach to installing Poetry that means we can
skip installing pip into its virtual environment, but still support
the outdated Python versions which bundle older pip (that don't support
the `--python` option; see #1687) or that don't correctly isolate the
environment when running `ensurepip` (see #1698).

Skipping installing pip speeds up the cold cache build for Poetry
slightly, and also reduces the build cache size (which will help with
the cache save and restore times for warm builds too).

The pip installed in the Poetry venv wasn't exposed to apps (since it
wasn't on `PATH`) so is safe to remove.

GUS-W-17895154.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants