Skip to content

In version-constraints prefix-matching (with .*) is not respected after a pre-release version #6774

@itsdani

Description

@itsdani

Issue

We have a package (lib-one) which has the following versions:

  • 1.0.6a1
  • 1.0.6a1.post1.dev20221011110403
  • 1.0.6a1.post2.dev20221011110301
  • 1.0.7

We would like to install the latest post-release for 1.0.6a1 i.e. 1.0.6a1.post2.dev20221011110301 with a version constraint ==1.0.6a1.*. There is no lock-file yet. After poetry install an unexpected version is installed.

Expected behavior

We expect the 1.0.6a1.post1.dev20221011110403 to be installed

Actual behavior

The 1.0.6a1 version is installed

The relevant output from poetry install -vvv:

Updating dependencies
Resolving dependencies...
   1: fact: lib-two is 1.0.0
   1: derived: lib-two
   1: fact: lib-two depends on lib-one (==1.0.6a1.*)
   1: selecting lib-two (1.0.0)
   1: derived: lib-one (==1.0.6a1)
   1: selecting lib-one (1.0.6a1)
   1: Version solving took 0.304 seconds.
   1: Tried 1 solutions.

Workaround

In this case the version constraint ">=1.0.6a1, <1.0.6a2" basically does what we want, but based on the documentation and PEP 440, the ==1.0.6a1.* constraint should result in the same package version in this scenario.

This worked as expected in poetry 1.1.15, but doesn't work since 1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/solverRelated to the dependency resolverkind/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