JulianEberius / SublimePythonIDE

ST3 only: A rewrite of SublimeRope for ST3, uses the Rope library to add python completions and refactoring to ST3
GNU General Public License v2.0
267 stars 38 forks source link

Project root relative Python path? #59

Closed miohtama closed 8 years ago

miohtama commented 10 years ago

I am always using Python from venv virtualenv folder which is in the Sublime project root folder.

Is it possible to have a SublimePythonIDE project setting where Python interpreter is relative to the project root?

// SublimePythonIDE
"settings": {
    "python_interpreter": "relative/path/here/venv/bin/python"
}  
asfaltboy commented 9 years ago

This lookup in relation to project dir, is actually already being automatically performed using "venv" as the default folder name. Please not that this dir should exist in the "project root" (which is either the top folder of the project, or whatever defined in the setting "src_root".

For more info see the project_venv_python function

So, if your root project folder has a subdirectory "venv" with a virtualenv structure, it should be automagically detected.

If you require a more precise control over the location of the venv, i.e the venv is at some_subfolder/venv/..., the you can set the project setting: virtualenv_dir_name to a relative path some_subfolder/venv and it will be joined on top of the root dir when auto detecting the venv.