python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.69k stars 2.27k forks source link

"Invalid constraint" message for package dependencies, but they are valid for pip #4777

Closed violuke closed 2 years ago

violuke commented 2 years ago

Issue

> poetry add markdown==3.3.5

Updating dependencies
Resolving dependencies... (0.0s)PackageInfo: Invalid constraint (importlib-metadata (>='4.4') ; python_version < "3.10") found in markdown-3.3.5 dependencies, skipping
Resolving dependencies... (0.1s)

Writing lock file

No dependencies to install or update

Full discussion on markdown package https://github.com/Python-Markdown/markdown/issues/1195, where they are saying that the versioning is correct and this is a Poetry problem. I'm no expert, but given it can install with pip, I think this likely is a Poetry issue.

kevr commented 2 years ago

I'm getting the same issue here; same exact package.

However, I've gone a bit further here and found that markdown==3.3.4 still works fine. I'm not sure if this is a severe poetry screw-up at this point with versioning, but I'm thinking that it's a markdown issue, not a poetry issue, based on the fact that 3.3.4 works fine and 3.3.5 doesn't; they obviously changed versioning between these.

Not to say that it's not an issue in poetry, but, clearly the issue can be worked around as was < 3.3.5.

violuke commented 2 years ago

I honestly don't know if this is Poetry or markdown (it's outside my area of expertise), but the guys on the thread https://github.com/Python-Markdown/markdown/issues/1195 in the markdown repo are pretty adamant that this is a Poetry issue, not a markdown issue, and to back up this theory, markdown 3.3.5 can be installed just fine with pip.

The version constraints did change in markdown 3.3.5 but they claim that the format used is valid:

install_requires=["importlib-metadata>='4.4';python_version<'3.10'"], 

https://github.com/Python-Markdown/markdown/blob/7919bfd8cf44e4fb50a3ccbd82b725db34b66a08/setup.py#L77

matousek-martin commented 2 years ago

Also running into the issue. Everything else works, it just posts a lot of warnings.

abn commented 2 years ago

Hmm. As far as I can tell according to PEP 508, the single quotes (importlib-metadata>='4.4') are invalid.

wsp           = ' ' | '\t'
version_cmp   = wsp* <'<=' | '<' | '!=' | '==' | '>=' | '>' | '~=' | '==='>
version       = wsp* <( letterOrDigit | '-' | '_' | '.' | '*' | '+' | '!' )+>
version_one   = version_cmp:op version:v wsp* -> (op, v)
version_many  = version_one:v1 (wsp* ',' version_one)*:v2 -> [v1] + v2
versionspec   = ('(' version_many:v ')' ->v) | version_many
abn commented 2 years ago

As a workaround you can add importlib-metadata explicitly to your project. The warnings won't go away though.

abn commented 2 years ago

Resolved in markdown via https://github.com/Python-Markdown/markdown/pull/1197.

github-actions[bot] commented 8 months ago

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.