Skip to content
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

Best match should be a pre-release if that's all the index has #151

Open
wimglenn opened this issue Oct 20, 2024 · 0 comments
Open

Best match should be a pre-release if that's all the index has #151

wimglenn opened this issue Oct 20, 2024 · 0 comments
Assignees

Comments

@wimglenn
Copy link
Contributor

wimglenn commented Oct 20, 2024

Hi, I'm not 100% sure if this may be considered a bug, but if Unearth serves as a stable replacement for pip's PackageFinder API should be understood as meaning a drop-in replacement, then perhaps it is?

Pip will select a pre-release if that is all that is available in the index:

$ python3 -m pip --version
pip 24.2 from .venv/lib/python3.13/site-packages/pip (python 3.13)
$ python3 -m pip install --index-url=https://test.pypi.org/simple alphaonly123 
Looking in indexes: https://test.pypi.org/simple
Collecting alphaonly123
  Downloading https://test-files.pythonhosted.org/packages/b9/79/350172f075790dc4ae3127ca6b80c93d874db7341bc9f2a829cb24fa1044/alphaonly123-1.0a1-py2.py3-none-any.whl.metadata (284 bytes)
Downloading https://test-files.pythonhosted.org/packages/b9/79/350172f075790dc4ae3127ca6b80c93d874db7341bc9f2a829cb24fa1044/alphaonly123-1.0a1-py2.py3-none-any.whl (888 bytes)
Installing collected packages: alphaonly123
Successfully installed alphaonly123-1.0a1

But unearth won't, it needs to be asked explicitly for pre-releases to be included.

$ python3 -m pip install -q unearth                                           
$ python3
Python 3.13.0 (v3.13.0:60403a5409f, Oct  7 2024, 00:37:40) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unearth import PackageFinder
>>> finder = PackageFinder(index_urls=["https://test.pypi.org/simple"])
>>> result = finder.find_best_match("alphaonly123")
>>> result.best
>>> result
BestMatch(best=None, applicable=<unearth.utils.LazySequence object at 0x101f2d6d0>, candidates=<unearth.utils.LazySequence object at 0x101e0acf0>)

Perhaps, with the default allow_prereleases=None mode, it should match pip - i.e. allow a pre-release if that is all the indices have available?

@frostming frostming self-assigned this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants