Skip to content

poetry selects wrong python version when markers present #4959

@maciejskorski

Description

@maciejskorski
  • 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: linux + Python 3.8.10
  • Poetry version: 1.2.0a2 (recent master)

Issue

Multiple constraints on python version fail when combined with valid markers.

This does work fine

# selecting 1.3.1 matching the system
[tool.poetry.dependencies]
python = "~3.8"
pandas = [
    {version="1.3.2",python='~3.9'},
    {version="1.3.1",python='~3.8'},
]

but not this

# selecting incompatible 1.3.2 and ignoring 1.3.1 - error
[tool.poetry.dependencies]
python = "~3.8"
pandas = [
    {version="1.3.2",python='~3.9',markers="sys_platform=='linux'"},
    {version="1.3.1",python='~3.8'},
]

when I move everything to markers it works fine again

# selecting 1.3.1 - fine!
[tool.poetry.dependencies]
python = "~3.8"
pandas = [
    {version="1.3.2",markers="python_version=='3.9' and sys_platform=='linux'"},
    {version="1.3.1",markers="python_version=='3.8'"},
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions