Reputation: 13505
I'm trying to release a demo repository (where people can directly run python scripts to demonstrate some experiment). I also need to include dependencies (numpy, etc). I'd like to use pip to make it easy.
I've already made a setup.py file listing all the dependencies. I'd now like to install my repo's code the the current directory, and all the dependencies to the default path (eg. ./venv/lib/python2.7
, venv/src/
, etc).
Now, if I just run
pip install -e git+http://github.com/petered/my_repo.git#egg=my_repo
Everything works, except the code in my_repo
gets saved in the /venv/src
(whereas I want it in the root directory).
I can also run
pip install -e git+http://github.com/petered/my_repo.git#egg=my_repo --target=.
Which installs everything in the root (current) directory. But then all dependencies also end up in this directory.
How can I pip install just the source code of a package in the current directory, but all dependencies in the default directory for dependencies?
Upvotes: 0
Views: 2015
Reputation: 36805
My projects usually have a setup.py
file that defines all dependencies. To install the project in a virtualenv I then first clone the repository and then simply install the cloned repository:
git clone http://github.com/petered/my_repo.git .
pip install -e .
This will install my_repo
where it is, but install all dependencies into lib/python2.7/site-packages/
.
You will notice that this layout makes it possible to later publish the my_repo
to PyPI, or install it as a dependency into lib/...
if you wish to do so as the library itself has no idea about how it was installed.
Whenever I have several "private dependencies" (closed source, only available on our git server), I write installation instructions like
git clone http://github.com/petered/my_repo.git
git clone http://github.com/petered/my_repo_dependency_1.git
git clone http://github.com/petered/my_repo_dependency_2.git
pip install -e my_repo_dependency_1
pip install -e my_repo_dependency_2
pip install -e my_repo
in the readme file. This will install all private dependencies in place, but install all public PyPI dependencies in lib/python2.7/site-packages/
.
Upvotes: 1