[Distutils] PyPi’s predictable download url
Nick Coghlan
ncoghlan at gmail.com
Wed Jul 26 10:21:38 EDT 2017
On 26 July 2017 at 04:45, Aleks Bunin <b at enlnt.com> wrote:
> Hello,
>
> I’m writing installation instructions for a package and have a question:
> what is the correct predictable URL for the package? I found couple. Which
> one of these guaranteed won’t change again in the future?
>
> https://pypi.python.org/packages/source/v/virtualenv/virtualenv-15.1.0.tar.gz
> (used to work in the past, but doesn’t seem to work now, copied from
> virtualenv’s docs)
> https://pypi.io/packages/source/v/virtualenv/virtualenv-15.1.0.tar.gz
> https://pypi.org/packages/source/v/virtualenv/virtualenv-15.1.0.tar.gz
> https://files.pythonhosted.org/packages/source/v/virtualenv/virtualenv-15.1.0.tar.gz
>
> Is there a predictable URL, which will return latest version of the
> package?
No, and it isn't particularly straightforward to go from a downloaded
tarball to a correctly installed component either. Direct downloads
will also bypass any pre-published wheel files.
While https://www.python.org/dev/peps/pep-0503/ defines the current
API for tools to retrieve this information from the service, the most
robust option is to instead let a dedicated client tool like pip
handle the problem:
* pip install: retrieve *and* install a component
* pip download: just retrieve the files without installing them locally
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Distutils-SIG
mailing list