Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Incorrect poetry export output with dependency conditional on Python version #5141

Closed
3 tasks done
glennmatthews opened this issue Feb 2, 2022 · 4 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@glennmatthews
Copy link

glennmatthews commented Feb 2, 2022

  • 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 12.2

  • Poetry version: 1.1.12

Issue

Running poetry export --format requirements.txt --without-hashes with the below pyproject.toml produces an invalid requirements file, specifically:

click==7.1.2
click==8.0.3; python_version >= "3.7"

which will fail pip for any python version of 3.7 or later. Presumably the click==7.1.2 dependency should include a python_version < "3.7", but it does not.

Minimal pyproject.toml to reproduce this issue:

[tool.poetry]
name = "poetry-test"
version = "0.1.0"
description = ""
authors = ["Glenn Matthews <glenn.matthews@networktocode.com>"]

[tool.poetry.dependencies]
python = "^3.6"
celery = [
    {version = "~5.1.0", python = "<3.7"},
    {version = "~5.2.0", python = ">=3.7"},
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
% poetry export --format requirements.txt --without-hashes
amqp==5.0.9
billiard==3.6.4.0
cached-property==1.5.2
celery==5.1.2; python_version < "3.7"
celery==5.2.3; python_version >= "3.7"
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.2.0
click==7.1.2    <------------------<< seems incorrect
click==8.0.3; python_version >= "3.7"
colorama==0.4.4; python_version >= "3.7" and python_full_version < "3.0.0" and platform_system == "Windows" or platform_system == "Windows" and python_version >= "3.7" and python_full_version >= "3.5.0"
importlib-metadata==4.10.1
kombu==5.1.0; python_version >= "3.6" and python_version < "3.7"
kombu==5.2.3; python_version >= "3.7"
prompt-toolkit==3.0.3
pytz==2021.3
six==1.16.0
typing-extensions==4.0.1; python_version < "3.8" and python_version >= "3.7"
vine==5.0.0
wcwidth==0.2.5
zipp==3.7.0; python_version < "3.8" and python_version >= "3.7"
@glennmatthews glennmatthews added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Feb 2, 2022
@radoering
Copy link
Member

The issue seems to be fixed in master, maybe even in the latest 1.2.0 pre-release.

@dimbleby
Copy link
Contributor

dimbleby commented Feb 3, 2022

really? when I tried I got this mess

...
click==7.1.2
click==7.1.2 ; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.7" or python_version >= "3.6" and python_version < "3.7" and python_full_version >= "3.5.0"
click==8.0.3 ; python_version >= "3.7"
...

@radoering
Copy link
Member

@dimbleby Hmm, in my output the first line without any markers is missing. It is possible that my state of master was not clean, but I thought I used a clean 1.2.0a2 and got the same result. The second line seems messy but could be correct. Poetry is just not able to simplify the constraint.

Copy link

github-actions bot commented Mar 1, 2024

This issue 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants