Ported from the abandoned Sublime Text - Virtualenv.
Manage your virtualenvs directly from Sublime Text 3.
- Reusable build system. Execute code with a virtualenv without editing your paths manually.
- Virtualenv search. Finds virtualenvs in the open folders or anywhere in your system.
- Activation/Deactivation. Select or disable the current virtualenv easily.
- Create and delete virtualenvs. With target python selection. Supports both the standard virtualenv package and the built-in venv module from Python 3.3.
- Integration with other packages. SublimeREPL.
Only Sublime Text 3. Tested in Linux and Windows but it should work in OS X as well.
Install through Package Control by first adding this repository:
- Open the command palette
- Select
Package Control: Add Repository
- Enter
https://github.com/Stack-of-Pancakes/st-python-virtualenv
when prompted - Open the command palette again
- Select
Package Control: Install Package
- Select
st-python-virtualenv
Or download zip and place it in your packages folder
- Open your packages folder. Menu item Preferences -> Browse Packages...
- Place this repository in that folder one of two ways a Clone this repository into it's own folder b Download this repository as a zip and place it into the folder
- Sublime Text should load the package on it's next run
Enable the Python + Virtualenv
build system through the Tools -> Build System
menu and execute with Ctrl+B
. If you do not have any other custom Python builds defined, Automatic
should work too.
The build system works with or without an activated virtualenv, so it can be used as default build for Python.
Search Virtualenv: Activate
in the command palette and select the desired virtualenv.
The command Virtualenv: Deactivate
is available when a virtualenv is activated.
Choose Virtualenv: New
(or Virtualenv: New (venv)
for built-in virtualenv), type a destination
path and select a python binary. The new virtualenv will be activated automatically.
Use the command Virtualenv: Remove
, choose a virtualenv and confirm.
Launch a Python REPL using the current virtualenv with the command Virtualenv: SublimeREPL - Python
.
The list of default settings is available through Preferences -> Package Settings -> Virtualenv -> Default
. Do not modify the default settings as you will lose all the changes if the package is updated. You should override the necessary settings in Package Settings -> Virtualenv -> User
instead.
The executable used for virtualenv creation. Defaults to python -m virtualenv
, assuming that virtualenv is installed on the default python prefix.
Depending on your setup you might want to change this to something like: virtualenv
, virtualenv-3.3
, python3 -m virtualenv
, etc.
A list of directory paths searched for virtualenvs. By default, includes virtualenvwrapper's WORKON_HOME
. ~/.virtualenvs
in Linux and OS X, and ~\Envs
in Windows (virtualenvwrapper-win).
There is a shortcut command for quickly adding a virtualenv directory to your settings: Virtualenv: Add directory
.
Additional paths searched for python binaries. It might be useful in case of portable python installations. Defaults to none.
The current virtualenv path is stored in the project settings and can be edited manually if the project has been saved to a *.sublime-project
file.
Extending or customizing the build system should be possible. Just set "target": "virtualenv_exec"
in your build system definition, or import and inherit from Virtualenv.commands.VirtualenvExecCommand
. More information on Sublime Text's build systems here.
Just some ideas for possible improvements.
- Integration with more packages. Paths for SublimeCodeIntel?
- Brother package for
pip
commands.