Skip to content
New issue

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

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

Already on GitHub? # to your account

config: fix handling of venv opts env vars #9015

Merged
merged 2 commits into from
Feb 25, 2024

Conversation

abn
Copy link
Member

@abn abn commented Feb 25, 2024

This change correctly handles virtual environment creation options provided via environment variables. For example, previously when POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES was specified via an environment variable, this was incorrectly ignored when a virtual environment was created.

Reproduction Instruction

podman run --rm -i --entrypoint bash docker.io/python:3.12 <<EOF
set -xe
python -m pip install --disable-pip-version-check -q git+https://github.com/python-poetry/poetry.git
export POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES=true
export POETRY_VIRTUALENVS_IN_PROJECT=true
poetry new demo
pushd demo
poetry install
cat .venv/pyvenv.cfg
EOF

Current Behaviour

The key include-system-site-packages is set to false.

home = /usr/local/bin
implementation = CPython
version_info = 3.12.2.final.0
virtualenv = 20.25.1
include-system-site-packages = false
base-prefix = /usr/local
base-exec-prefix = /usr/local
base-executable = /usr/local/bin/python3.12
prompt = demo-py3.12

After Fix Behaviour

podman run --rm -i --entrypoint bash docker.io/python:3.12 <<EOF
set -xe
python -m pip install --disable-pip-version-check -q git+https://github.com/python-poetry/poetry.git@refs/pull/9015/head
export POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES=true
export POETRY_VIRTUALENVS_IN_PROJECT=true
poetry new demo
pushd demo
poetry install
cat .venv/pyvenv.cfg
EOF

The key include-system-site-packages is correctly set to true.

home = /usr/local/bin
implementation = CPython
version_info = 3.12.2.final.0
virtualenv = 20.25.1
include-system-site-packages = true
base-prefix = /usr/local
base-exec-prefix = /usr/local
base-executable = /usr/local/bin/python3.12
prompt = demo-py3.12

@abn abn marked this pull request as ready for review February 25, 2024 02:30
@abn abn requested a review from a team February 25, 2024 03:18
abn added 2 commits February 25, 2024 04:24
This change correctly handles virtual environment creation options
provided via environment variables. For example, previously when
`POETRY_VIRTUALENVS_OPTIONS_SYSTEM_SITE_PACKAGES` was specified via an
environment variable, this was incorrectly ignored when a virtual
environment was created.
@abn abn force-pushed the fix-nested-config-env-var branch from d80ee79 to 94f3c57 Compare February 25, 2024 03:24
@abn abn enabled auto-merge (rebase) February 25, 2024 03:24
@abn abn merged commit 8ca6c6d into python-poetry:master Feb 25, 2024
20 checks passed
@abn abn deleted the fix-nested-config-env-var branch February 25, 2024 03:32
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants