Skip to content

Why does the filter method of SpecifierSet with a single specifier behave differently to Specifier?  #856

Open
@notatallshaw

Description

@notatallshaw

Here are two cases where I don't understand why SpecifierSet and Specifier behave differently.

One where only a pre-release is available out of all versions, according to the spec I would expect the pre-release to be available:

>>> list(SpecifierSet('<=2.0.0').filter(["1.0a1"]))
[]
>>> list(Specifier('<=2.0.0').filter(["1.0a1"]))
['1.0a1']

Two, where there is a pre-release and non-prerelease but only the pre-release matches the specifier requirements, again according to the spec I would expect the pre-release to be available:

>>> list(SpecifierSet('>1.1').filter(["1.1", "2.0a1"]))
[]
>>> list(Specifier('>1.1').filter(["1.1", "2.0a1"]))
['2.0a1']

Because pip heavily uses SpecifierSet (I think because the Specifier object is newer) it means pip is often not following the spec as expected.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions