Individual venv per branch

I'm working on 2 different versions of a project, each on an individual branch. One is using the stable version of the library while the other is a wip rewrite using the unstable beta version. Is there anyway to have 2 different virtual environments in 1 project. Ofc it'd be best if the venvs would automatically switch on checkout, but as long as I can actually work on both branches in the same project, I'd be happy :)

Any ideas?

0
1 comment

Hello,

You can set up different environments with Run configurations.

To do so, right-click on the script you want to run with a specific interpreter either in the Project structure tool window or the editor, **More Run/Debug...| Modify Run Configuration**. In this menu, you can set up a specific interpreter and other run options, and you can set those for each branch.

For example, you have a main.py file that you want to run in the main branch with Python venv and the feature branch with Conda env. To do so, check out the main branch and set up the virtual environment as an interpreter for main.py, then switch the branch to feature and set for the same main.py file an Anaconda interpreter. 

Here is an article with more details regarding setting up the run configuration for Python.

0

Please sign in to leave a comment.