Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python
branch: master
Failed to load latest commit information.
examples Add Cheesefile.lock reader and writer
pbundler Fix broken fix for #27
.gitignore Turn into an egg
LICENSE Release 0.0.2
MANIFEST.in Make sure README and other files end up in the tar
PHILOSOPHY.md the big rewrite
README.md fix README.md
THANKS
setup.py add --version flag to cli

README.md

Python Bundler

Simplifies virtualenv and pip usage.

Aims to be compatible with all existing projects already carrying a "requirements.txt" in their source.

Inspired by http://gembundler.com/

Howto

  • easy_install pbundler
  • cd into your project path
  • Run pbundle. It will install your project's dependencies into a fresh virtualenv.

To run commands with the activated virtualenv:

pbundle exec bash -c 'echo "I am activated. virtualenv: $VIRTUAL_ENV"'

Or, for python programs:

pbundle py ./debug.py

If you don't have a requirements.txt yet but have an existing project, try this:

pip freeze > requirements.txt

If you start fresh, try this for a project setup:

mkdir myproject && cd myproject
git init
pbundle init

Instructions you can give your users:

git clone git://github.com/you/yourproject.git
easy_install pbundler
pbundle

If you rather like pip, and you're sure your users already have pip:

git clone git://github.com/you/yourproject.git
pip install pbundler
pbundle

Making python scripts automatically use pbundle py

Replace the shebang with "/usr/bin/env pbundle-py". Example:

#!/usr/bin/env pbundle-py
import sys
print sys.path

WSGI/Unicorn example

start-unicorn.sh:

#!/bin/bash
cd /srv/app/flaskr
PYTHONPATH=/srv/app/wsgi exec pbundle exec gunicorn -w 5 -b 127.0.0.1:4000 -n flaskrprod flaskr:app

Custom environment variables

If you need to set custom ENV variables for the executed commands in your local copy, do this:

echo "DJANGO_SETTINGS_MODULE='mysite.settings'" >> .pbundle/environment.py

TODO

  • Build inventory from what is installed, instead of requirements.last file
  • Handle failed egg installs
  • Really remove all no longer needed packages from virtualenv
  • Reorganize library code
Something went wrong with that request. Please try again.