4

Is there a one-liner shortcut for:

git clone https://github.com/user/mypythonmodule.git
cd mypythonmodule
python setup.py install
cd ..

like

git clone install https://github.com/user/mypythonmodule.git

or doesn't this exist?

Stephen Paulger
5,3733 gold badges31 silver badges46 bronze badges
asked May 21, 2015 at 8:31
5
  • 1
    git clone github.com/user/mypythonmodule.git && python mypythonmodule/setup.py install Commented May 21, 2015 at 8:33
  • install it using pypi : pip install mypythonmodule Commented May 21, 2015 at 8:35
  • @PeterClause: I tried but doesn't work because the current path won't be mypythonmodule with your solution Commented May 21, 2015 at 8:36
  • @ImanMirzadeh: such git projects are not always on Pypi Commented May 21, 2015 at 8:36
  • @Basj: yup ! but they usually are :D Commented May 21, 2015 at 8:38

1 Answer 1

11

If you use pip it supports installing from git URLs.

From the pip documentation

"pip currently supports cloning over git, git+https and git+ssh"

So you would do

pip install git+https://github.com/user/mypythonmodule.git
answered May 21, 2015 at 8:36
Sign up to request clarification or add additional context in comments.

3 Comments

Nice solution. I admit, that I first wanted to avoid asking target users to install pip, because on my Raspbian Wheezy : apt-get install python-pip installs pip + .... Python 2.6 on top of Python 2.7 ... :s ugly !
Is Python 2.7 default in Raspbian Jessie? Alternatively if you have a python 2.7 easy_install you could install pip using that rather than apt.
@StephenPaulger, does that really work without the git+prefix? For me it seems that it has to be pip install git+https://github.com/user/mypythonmodule.git

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.