Fix the invalid path of python virtualenv when using glob. #303

Open
wants to merge 1 commit into from

3 participants

@lemonlatte

When I create a virtualenv, the bin folder is a child folder of a virtualenv.
Therefore, with the additional asterisk, activate_this.py won't be find by python glob.

@wuub
Owner

python_virtualenv_paths is the list of directories where virtualenvs are created, not a list of virtualenvs.

For example when you use virtualenvwrapper it'll create virtualenvs in ~/.virtualenvs directory, and glob pattern is meant to match following activate_this.py scripts.

~/.virtualenvs/venv1/bin/activate_this.py
~/.virtualenvs/venv2/bin/activate_this.py
~/.virtualenvs/venv3/bin/activate_this.py

@wuub wuub closed this Dec 10, 2013
@lemonlatte

Thanks! I know what's different. I set up virtualenv per app rather than centralize them. That's why it is not work for me.

@wuub
Owner

Maybe we should add an option of setting specific virtualenv per sublime project? What do you think about that?

@wuub wuub reopened this Dec 10, 2013
@lemonlatte

It sounds great to have a project setting. But, I think it is simplify to add a list for virtualenv folders in user setting.

Take my directory for example, I usually setup virtualenv directly under an app. The tree of directory would look like the following:

Source/App1/
Source/App1/.git
Source/App1/.venv
Source/App2/
Source/App2/.git
Source/App2/.venv

Since glob won't find the hidden folder, I point the path to my apps in this way: ~/Source/*/.venv.
This works well for me after I patch the asterisk.

I prefer this kind of solution so that you don't need to configurate virtualenv paths for each projects.

@Chris-May

Hey Wojciech!
I'm curious about this thought you proposed back in 2013 about having an option in a sublime project (or possibly sublime workspace?) to specify a virtual environment.

I've been loving SublimeREPL's support for virtual environments when set up with the virtualenv tool, but I've been messing around with python's new native pyvenv command, only to find out that I can't seem to use SublimeREPL with these environments.

I'd be happy to contribute code to help with this. Is this something you would like to see as a part of SublimeREPL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment