poetry-plugin-export: 1.1.2: regression with poetry export when using python version constraints.
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: MacOS 10.15.5
- Poetry version: 1.1.2
- Link of a Gist with the contents of your pyproject.toml file: N/A
Issue
I have notice a regression compared to poetry 1.0.10 in the following case:
- I add package dependency with a python version constraint (“typing-extensions”)
- I add a development dependency having the same sub-dependency with no python version constraint (“black”).
The command poetry export
give a wrong result with poetry 1.1.2 (it’s OK with 1.0.10)
How to reproduce:
poetry new example
cd example
sed -i '/^python = /s/3.8/3.7/' pyproject.toml
poetry add --python="<3.8" typing-extensions
poetry export -f requirements.txt | grep typing
poetry add --dev black
poetry export -f requirements.txt | grep typing
Output for Poetry 1.0.10 (Python 3.8.6):
...
typing-extensions==3.7.4.3; python_version < "3.8" \
...
typing-extensions==3.7.4.3 \
Output for Poetry 1.1.2 (Python 3.8.6):
...
typing-extensions==3.7.4.3; python_version < "3.8" \
...
typing-extensions==3.7.4.3; python_version < "3.8" \
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 27 (9 by maintainers)
Commits related to this issue
- locker: improve nested marker propagation Resolves: #3160 — committed to abn/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to abn/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to abn/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to abn/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to python-poetry/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to abn/poetry by abn 4 years ago
- locker: propagate cumulative markers to nested deps This change ensures that markers are propagated from top level dependencies to the deepest level by walking top to bottom instead of iterating over... — committed to python-poetry/poetry by abn 4 years ago
original bug report seems not to be a regression but a fix: adding a dev-dependency should not affect the export of non-dev packages. If we instead
export --dev
then the marker is relaxed as expected.Example at https://github.com/python-poetry/poetry-plugin-export/issues/30#issuecomment-721439552 also works fine today:
export
givesand
export --dev
givesThis is fixed.
@abn @finswimmer Could you have a look at this? This was a regression in Poetry 1.1.3 that is still present in 1.1.4. It affects every project that has pre-commit in its development dependencies and supports Python 3.6. Thank you!
I have narrowed the repro down a little further.
Create this
pyproject.toml
:Then export the requirements:
If you look at the output, you can see that the python constraint
<3.7
onimportlib-resources
affects its dependency zipp, but it shouldn’t because zipp is also a dependency of pytest (via importlib-metadata), which doesn’t have a marker.Update: This also reproduces with Poetry’s master. As a side note, reproducing it on master required running in a Python 3.7 environment. With Python 3.9 the dependency on importlib-metadata (and, by extension, on zipp) did not appear at all, even with
poetry show --tree
. But that seems to be an unrelated issue.@oncleben31 I have added a fix to the same branch so that we emulate the same behaviour as
1.0.10
.