Skip to content

Commit 7fc528c

Browse files
committed
python-setup: Don't allow Poetry to make venv in project
I mostly verified this works on my local machine, but did add a sample `poetry.toml` to the tests, so it can be verified from looking at the logs 🤷
1 parent 1653364 commit 7fc528c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

python-setup/auto_install_packages.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ def _check_output(command, extra_env={}):
3333

3434
def install_packages_with_poetry():
3535

36-
# To handle poetry 1.2, which started to use keyring interaction MUCH more, we need
37-
# add a workaround. See
38-
# https://github.com/python-poetry/poetry/issues/2692#issuecomment-1235683370
39-
extra_poetry_env = {"PYTHON_KEYRING_BACKEND": "keyring.backends.null.Keyring"}
36+
extra_poetry_env = {
37+
# To handle poetry 1.2, which started to use keyring interaction MUCH more, we need
38+
# add a workaround. See
39+
# https://github.com/python-poetry/poetry/issues/2692#issuecomment-1235683370
40+
"PYTHON_KEYRING_BACKEND": "keyring.backends.null.Keyring",
41+
# Projects that specify `in-project = true` in their poetry.toml would get the
42+
# venv created inside the repo directory, which would cause CodeQL to consider
43+
# it as user-written code. We don't want this to happen.
44+
"POETRY_VIRTUALENVS_IN_PROJECT": "False",
45+
}
4046

4147
command = [sys.executable, '-m', 'poetry']
4248
if sys.platform.startswith('win32'):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[virtualenvs]
2+
in-project = true

0 commit comments

Comments
 (0)