3

To bypass dependency conflicts, my team is migrating to a new setup where each branch of our build will have different virtualenvs (with different dependencies in requirements.txt files for pip to install). The entire team is on Pycharm and mercurial.

Question: Is there an easy way to have Pycharm automatically switch to the respective virtualenv when switching between branches? I stress automatically, because we devs switch between different branches many times a day, and if we forget to change virtualenvs it can be problematic

Anconia
  • 3,888
  • 6
  • 36
  • 65

1 Answers1

3

I suggest to implement this via a post-update hook:

Commit to each branch a description file or better a small script which - when called - updates your environment to however you need it. And have the hook check for the presence of that script and call it when found.

Backdraw: every developer has to install that hook in his own .hgrc. But that's a one-time setup compared to manual update every time :)

planetmaker
  • 5,884
  • 3
  • 28
  • 37
  • I got this up and running! My problem now is that my virtualenv isn't being activated when the post update hook is ran. Please see http://stackoverflow.com/questions/33532382/mercurial-update-hook-not-activating-python-virtual-environment – Anconia Nov 05 '15 at 01:14