1

Suppose I have a private git repo(A library repo) which I want to use from my project. (B project repo)

I clone A to my ~/workspace/A and I work on my project at ~/workspace/B

B 's virtualenv resides in ~/virtualenvs/B

In order to modify A and test the modified from B,

  1. modify A
  2. commit push to A's origin
  3. pip install A git+http://A-repository

Which is very time consuming.. Can I reduce the above steps to

  1. modify A

by placing A inside somewhere in project B's virtualenv?

and commit & push only after I test the modified A from B?

** Edit

I could think of two ways and wonder if there's better way.

  1. add A as a git submodule to B somewhere (which is in python module path) under ~/workspace/B : I just didn't like submodule whenever I used it.. hard to grasp and manage them.

  2. add ~/workspace/parent-of-A/ to python-path before virutalenv python-path So when I edit ~/workspace/parent-of-A/A, it is readily seen by B.
    And production server and other people who don't modify A could use pip install-ed version in virtualenv.

eugene
  • 39,839
  • 68
  • 255
  • 489
  • 1
    possible duplicate or variant of: http://stackoverflow.com/q/15031694/1298153 – m01 Jan 20 '16 at 13:14
  • 1
    Activate B's virtualenv, cd to A directory and `python setup.py devel` should probably work. – Yaroslav Admin Jan 20 '16 at 13:14
  • @m01: it requires me to create .tar.gz of the library. I hope I could avoid creating an archive to use my library. – eugene Jan 20 '16 at 13:19
  • @eugene No, it doesn't. See [second answer](http://stackoverflow.com/a/20043907/1377864). AFAIK it does the same thing as my suggestion, but using `pip`. – Yaroslav Admin Jan 20 '16 at 13:21
  • @YaroslavAdmin: ok . but still needs a separate step before I can test the library – eugene Jan 20 '16 at 13:24
  • 2
    You do it only once. It installs package by creating a symlink to the directory, where source files are located. So all changes in source files are immidiately reflected on installed package (see [this answer](http://stackoverflow.com/a/19048754/1377864)). – Yaroslav Admin Jan 20 '16 at 13:25
  • @YaroslavAdmin oh that's precisely I'm after, let me try that. – eugene Jan 20 '16 at 13:33
  • @YaroslavAdmin: so `python setup.py devlelop` seems to work great, although I'm not yet prepared to deploy the modified library and not sure how would I write the `A` into my `B` 's `requirements.pip` file so that I can deploy to other systems. (and keep my develop mode intact because I would need to keep modifying `A`) .. I'll update when I 'm ready to deploy `A` – eugene Jan 23 '16 at 13:25

0 Answers0