Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install my project from source with Buildout?

I want to use Buildout to install my Distribute-based project and its dependencies to an isolated environment. My project should be installed directly from the source tree (a local Git repository), and is not registered with PyPI. How do I accomplish this?

Edit:

Thanks to M. Pieters I was able to suss out what to do. I'm posting my buildout.cfg for reference:

[buildout]
develop = .
parts = fbt

[fbt]
recipe = z3c.recipe.scripts
eggs = BuildTools

Although I didn't need it right now, knowledge of mr.developer could definitely come in handy in the future.

like image 383
aknuds1 Avatar asked Apr 18 '11 13:04

aknuds1


2 Answers

You have 3 options, depending on where you want your buildout configuration to live and what options you have to check out your git repository.

Note that as far as Python is concerned, the resulting egg is exactly the same. The only difference between a development egg and a "normal" egg is that a development egg overrides any version requirements set elsewhere for that egg; it will be used regardless of what other versions of the egg are found elsewhere.

Inside the development repository

Just use the develop option. This creates a development egg, which is just the same as a normal egg but without a version check, nothing more, nothing less.

Your buildout simply needs to list the current directory (where setup.py lives) as the development egg:

[buildout]
develop = .

In a different location

You'll need to be able to reach the git repository for this to create a new checkout. Use mr.developer to pull in your git repository and automatically mark it as a development egg:

[buildout]
extensions = mr.developer
auto-checkout = package.name

[sources]
package.name = git url/to/package.name.git

With this setup, mr.developer will automatically check out the git repository to the src/ subdirectory and add that to the buildout develop option.

Using a tarball download

Places like github.com also offer an option to download a tarball with the current contents of the repository. You could use that to load that tarball as an egg source with the find-links option:

[buildout]
find-links = http://github.com/yourname/package.name/tarball/version#egg=package.name-versionnumber
eggs = package.name

Buildout will then use that specific find-links entry to find the egg, provided it cannot find the egg elsewhere.

like image 136
Martijn Pieters Avatar answered Nov 18 '22 16:11

Martijn Pieters


You easily use Buildout with checkouts from repository by either using the develop directive of zc.buildout or using the mr.developer buildout extension where you can define the packages to be checkout directly from a given repository URL (supports git, svn and others version control systems).

See

http://pypi.python.org/pypi/mr.developer

like image 3
Andreas Jung Avatar answered Nov 18 '22 15:11

Andreas Jung