Skip to content

Poetry 2.1 breaks -- (double-dash) handling #10204

@patrikspiess

Description

@patrikspiess

Description

Poetry 2.1 breaks to handling of the -- option.

Example:

Here you can see how Poetry 2.0.1 behaves:

user@host:~$ poetry -V
Poetry (version 2.0.1)

user@host:~$ poetry run tox --version
4.24.1 from /home/user/project/.venv/lib/python3.12/site-packages/tox/__init__.py

user@host:~$ poetry run tox --version --
4.24.1 from /home/user/project/.venv/lib/python3.12/site-packages/tox/__init__.py

This is OK. Even with a -- at the end the --version shows my tox version.

Then I upgrade Poetry to 2.1.1

user@host:~$ pipx upgrade poetry
upgraded package poetry from 2.0.1 to 2.1.1 (location: /home/user/.local/share/pipx/venvs/poetry)

user@host:~$ poetry run tox --version
4.24.1 from /home/user/project/.venv/lib/python3.12/site-packages/tox/__init__.py

user@host:~$ poetry run tox --version --
Poetry (version 2.1.1)

Now, you can see that with the -- option the --version shows the Poetry version instead of the tox Version.


This behaviour breaks our CI/CD pipeline when working with tox {posargs}
For example if we have a tox environment:

[testenv:pytest]
description = do unit tests with pytest
skip_install = true
allowlist_externals = poetry, pytest
commands_pre = poetry install
commands = pytest --basetemp=tests/temp/ {posargs}

When we try to call it with posargs we get the following error:

user@host:~$ poetry run tox -e pytest -- -- --junit-xml=tests.xml
The option "-e" does not exist

This is because the -- option passes the -e option back to Poetry instead leaving it with tox.
This worked pretty well with Poetry 2.1.1

Workarounds

I had to pin the Poetry version back to v2.0.1 in our CI/CD pipeline to make it work again.

Poetry Installation Method

pipx

Operating System

Windows 11 / WSL / Ubuntu 22.04

Poetry Version

Poetry (version 2.1.1)

Poetry Configuration

cache-dir = "/home/user/.cache/pypoetry"
data-dir = "/home/user/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python"  # /home/user/.local/share/pypoetry/python
repositories.testpypi.url = "https://test.pypi.org/legacy/"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/user/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions