How to Make Setuptools Install a Package That's Not on Pypi

How can I make setuptools install a package that's not on PyPI?

The key is to tell easy_install where the package can be downloaded. In this particular case, it can be found at the url http://github.com/mtai/python-gearman/tarball/master. However, that link by itself won't work, because easy_install can't tell just by looking at the URL what it's going to get.

By changing it to http://github.com/mtai/python-gearman/tarball/master#egg=gearman-2.0.0beta instead, easy_install will be able to identify the package name and its version.

The final step is to add the URL to your package's dependency_links, e.g.:

setup(
...
dependency_links = ['http://github.com/mtai/python-gearman/tarball/master#egg=gearman-2.0.0beta']
)

Now, when YOUR package is being installed, easy_install will discover that there is a "gearman 2.0.0beta" available for download from that URL, and happily pick it over the one on PyPI, if you specify "gearman>=2.0.0beta" in your dependencies..

(Normally, the way this sort of thing is done is to include a link on one's PyPI page to the downloadable source; in this case, if the author of the gearman package had included a link like the above, you'd be already set. Typically, people mark the development version with 'myproject-dev' and then people use a requirement of 'myproject>=somever,==dev', so that if there isn't a package of somever or higher, easy_install will try to check out or download the release.)

You'll need to specify --process-dependency-links when using pip. Note that dependency links processing has been deprecated and will be removed in a future release.

How to specify a different non-pypi package index url to setuptools.setup?

From abravalheri
at
https://github.com/pypa/setuptools/pull/3364:

I couldn't find anything in the latest packaging standards about
mixing multiple package indexes together directly on the package
specification. You need to use an external tool for that, like the pip
configuration file, or a package index mirror/proxy like devpi (maybe
bandersnatch also can do that?).

What is possible to do right now is to force a URL to a wheel file as
covered in PEP 440/PEP 508. But as you have already noticed, it
requires you to point to a specific file and don't allow for dynamic
version resolution.

So the short answer is no, unfortunately there seems to be nothing in
the packaging standards regarding that.

Sdist showing error while uploading package to pypi

I had to move the setup file above the main package as suggested by @phd in the 3rd comment in the comment section.



Related Topics



Leave a reply



Submit