Install Bash completion along with distutils / pip

I created a simple Python module and want to distribute using pip. I also want to install the Bash completion file along with the module. I am installing the module using Python 2.7.1+ and pip 0.8.2.

I have

    description='Jenkins Job Monitor',
        ('/etc/bash_completion.d', ['extras/jenkinsmon.completion']),
    install_requires = [


Now if I try to install a package with pip install -e .

, the Bash completion file is never installed with the package. I have also tried workarounds by specifying as described here :

include extras/jenkinsmon.completion


But that doesn't help either - the completion files won't be installed. What can be done to install Bash completion files?


source to share

2 answers

My mistake (besides not reading the pip documentation at all) was only to add -e

to the options pip install

, which means set to "editable" mode. Quote documentation

Using the --editable or -e option, pip can install directly from the source control repository (it currently supports Subversion, Mercurial, Git, and Bazaar):

pip install -e svn+

This is the shells option for the command line client for each corresponding VCS, so you must have VCS installed on your system. The repo url should start with svn + (or hg +, git +, or bzr +) and end with C # egg = packagename; otherwise, pip supports the same URL formats and wire protocols supported by VCS itself.

Pip will checkout the original repo against the src / directory inside virtualenv (i.e. pip_test_env / src / initools-dev) and then run python on that original repo. This "links" the code directly from the repo to the virtual sites directory (by adding the repo directory to easy-install.pth), so the changes you made to the original checkout take effect immediately.

If you already have a local VCS checkout that you want to keep using, you can simply use pip install -e path / to / repo to install it "editable" in the same way.

So, to install a package permanently on the system, I need to uninstall -r, then the Bash -completion files are installed as expected.


source only describes additional files that should be included in source distributions; it has nothing to do with installation.

Is the file installed if you run python install

? pip relies on setuptools, so it's possible that pip inherits its installation behavior in just one directory / zip file "egg".



All Articles