2

Any solid examples of using buildout to download a tarball from a specific branch in Git into my eggs directory?

All the answers i've tried seem to keep grabbing the version from PyPi instead.

I'm trying to grab the development branch of MongoKit... ( http://github.com/namlook/mongokit/tarball/devel#egg=mongokit) as a tarball...

Thanks.

KJQ
  • 447
  • 1
  • 7
  • 28

2 Answers2

2

You can add any python package hosted on git-hub by adding a find-links url pointing to the project tarball URL plus a #egg=packagename postfix. As you already discovered, for mongokit that is:

http://github.com/namlook/mongokit/tarball/devel#egg=mongokit

You can add a version number to that URL to provide buildout with a reason to prefer the github URL over the one found on PyPI. This is needed when the version numbers match, as is the case for mongokit at the time of answering. The version is appended with a dash:

http://github.com/namlook/mongokit/tarball/devel#egg=mongokit-0.6yourmarker1

I've added a marker to the version number and a counter; the addition of the marker means that the github version will be deemed newer than the version found on PyPI, but if 0.7 was released, it would be the newer one. You can make yourmarker anything you like, and you can upgrade the number if you needed to get the latest changes from github (the egg will be cached locally otherwise).

I'd also pin that version in the buildout.

So a simple buildout would be:

[buildout]
parts = whatever
find-links =
    http://github.com/namlook/mongokit/tarball/devel#egg=mongokit-0.6yourmarker1
eggs = mongokit
versions = versions

[versions]
mongokit = 0.6yourmarker1

From there on out you can use mongokit as a setuptools dependency (install_requires=['mongokit']).

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • This is what I've originally tried but I keep getting the PyPi version. Is there anything that could conflict (other find-links, order, etc.)? – KJQ Jun 26 '11 at 03:36
  • yes, I see now that the tarball version equals the version found on PyPI. I'll update my answer to provide a work-around for that. – Martijn Pieters Jun 26 '11 at 09:35
  • Ok, seem to be getting further. I see the lines I am looking for in MongoKit but i'm getting a conflict error running buildout afterwards: Installing mongokit 0.6dev Caused installation of a distribution: mongokit 0.6 with a different version. While: Installing pyramid. Error: There is a version conflict. We already have: mongokit 0.6 – KJQ Jun 26 '11 at 12:31
  • I think i got it! Needed "mongokit >= 0.6dev" under my versions. – KJQ Jun 26 '11 at 13:52
0

try the following in your buildout.cfg

[mongokit]
recipe = zerokspot.recipe.git
repository = git://repopath/mongokit.git
branch = devel
as_egg = true

The documentation is here.

Senthil Kumaran
  • 54,681
  • 14
  • 94
  • 131