-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Core doesn't install python version specific dependencies #3347
Comments
Replace the comma with a space [tool.poetry]
name = "toto"
version = "0.1.0"
description = ""
authors = ["Damien Matias"]
[tool.poetry.dependencies]
python = "^3.6.1"
dataclasses = {version = "^0.7", python = ">=3.6.1 <3.7"}
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
|
I agree documentation is not very explicit with what is considered a valid python specification for a package. https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies |
Seems to be a bug though, parse_constraint in poetry.core is working with ">=3.6.1,<3.7" |
Thank you for your answer ! I tried with your snipped and I still get the following :
I'm using in this venv : Python 3.6.10 and Pip 20.2.4. Here is a gist of
https://gist.github.com/DamienMatias/b1e2d1f4aba0b952ecc40678bee27e24 Do you mind sharing your python and pip version so that I can compare ? |
My bad it seems to be related when specifying patch version of python in the python constraints. [tool.poetry]
name = "toto"
version = "0.1.0"
description = ""
authors = ["Damien Matias"]
[tool.poetry.dependencies]
python = "^3.6.1"
dataclasses = {version = "^0.7", python = ">=3.6,<3.7"}
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api" This one is working correctly |
It worked, thank you so much ! :D |
It works but maybe this is not a normal behavior ? |
It seems to be related on how $ python --version
Python 3.6.12
$ python -m pip install "dataclasses ; python_version >= '3.6.1'"
Ignoring dataclasses: markers 'python_version >= "3.6.1"' don't match your environment
$ python -m pip install "dataclasses ; python_version >= '3.6'"
Collecting dataclasses
Using cached dataclasses-0.7-py3-none-any.whl (18 kB)
Installing collected packages: dataclasses
Successfully installed dataclasses-0.7 I agree this is a weird for the user. It should be simple to add a validator for python_version to catch this before encountering this behavior. |
It makes sense, thanks again ! |
Maybe related: #2480 |
IMO @DamienMatias you should reopen this. This is poetry-core related. When specifying python in your toml. poetry should translate in It seems poetry-core got the machinery to do this in But when using pip install with the PEP517 backend, dependency_markers are created with There seems to be code duplication here. For a quick fix we can use : if python_versions:
dependency.python_versions = python_versions
marker = marker.intersect(
parse_marker(
dependency._create_nested_marker(
"python_version", dependency.python_constraint
)
)
) But we should probably refactor those two function & just use one. from poetry.core.factory import Factory
from pathlib import Path
poetry = Factory().create_poetry(Path(".").resolve())
print(poetry.package.requires[0].marker) Actual : Any Core contributors can look into this? |
Awesome @jules-ch! I went down the dependency resolution rabbit hole as well the last day, and come to the same problematic lines, but did not figure put how to fix it. Your fix is working, but I would like @sdispater or @abn to have a look on this as well. I think they can better estimate if your solution has unwanted impact. Thanks a lot! fin swimmer |
There seems to be a bug out where poetry isn't installing certain dependencies with patch python version constraints. python-poetry/poetry#3347
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. |
-vvv
option).Issue
Hello guys, I'm currently working on a package that is meant to be compatible with python ^3.6 and we added
dataclasses
as a dependency only for python 3.6 which gives us the followingpyproject.toml
The issue is if I try to install the package using pip in a python 36 venv, it won't install
dataclasses
even though it's specifiedMaybe this is more a https://github.com/python-poetry/poetry-core issue ?
Thank you in advance :)
The text was updated successfully, but these errors were encountered: