You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [5]: from packaging.requirements import Requirement
...: from packaging.version import Version
...: req_numpy_with_ver = Requirement('numpy<3,>=1.23')
...: req_numpy_no_ver = Requirement('numpy')
...:
...: print(list(req_numpy_with_ver.specifier.filter([Version('2.2.0.dev')])))
...: print(list(req_numpy_with_ver.specifier.filter([Version('2.2.0.dev')], prereleases=True)))
...:
...: print(list(req_numpy_no_ver.specifier.filter([Version('2.2.0.dev')])))
...: print(list(req_numpy_no_ver.specifier.filter([Version('2.2.0.dev')], prereleases=True)))
...:
...:
[] # if a dependency:
[<Version('2.2.0.dev0')>]
[<Version('2.2.0.dev0')>] # trigger this is install direct
[<Version('2.2.0.dev0')>]
In [7]: packaging.__version__
Out[7]: '24.1'
This also lead to weird things:
>>> await micropip.install('numpy<3', index_urls=['https://cors.carreau.workers.dev/scientific-python-nightly-wheels/simple'])
# ValueError: Can't find a pure Python 3 wheel for 'numpy<3'.
Ok, this is because the filter operation of packaging is not distributive:
In [29]: list(SpecifierSet('').filter(['1.0','2.2.0.dev']))
Out[29]: ['1.0']
In [30]: list(SpecifierSet('').filter(['2.2.0.dev']))
Out[30]: ['2.2.0.dev']
found when working on #159, in particular #159 (comment)
Tracked down to:
This also lead to weird things:
but (note the lack of <3)
I don't know if it's a packaging bug, or an incorrect usage of packaging; so I'm opening the issue here.
The text was updated successfully, but these errors were encountered: