Skip to content

Conversation

@tdruez
Copy link
Contributor

@tdruez tdruez commented Nov 28, 2025

The previous implementation is too restrictive and returns random distribution.

Changes:

  • Add support for no-version PURLs (return latest version)
  • Split the code into several methods for versatility
  • Add the option to provide a preferred_type such as:
>>> from fetchcode.pypi import Pypi

>>> Pypi.get_download_url("pkg:pypi/[email protected]")
'https://files.pythonhosted.org/packages/e9/23/384d9953bb968731212dc37af87cb75a885dc48e0615bd6a303577c4dc4b/requests-2.28.0.tar.gz'

>>> Pypi.get_download_url("pkg:pypi/[email protected]", preferred_type="bdist_wheel")
'https://files.pythonhosted.org/packages/41/5b/2209eba8133fc081d3ffff02e1f6376e3117e52bb16f674721a83e67e68e/requests-2.28.0-py3-none-any.whl'

@tdruez tdruez merged commit b0a6e5a into master Nov 28, 2025
3 checks passed
@tdruez tdruez deleted the pypi-refactored branch November 28, 2025 08:08
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

Successfully merging this pull request may close these issues.

2 participants