python-poetry / python-poetry/poetry
Poetry 2.1 breaks -- (double-dash) handling
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two poetry run tox commands shown in the issue, including the CI/CD invocation with --. Trace the poetry run argument-forwarding entry point and add a regression test for preserving the separator and subsequent arguments. Done means the commands pass the trailing -- and -e options to tox rather than Poetry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100