ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Virtualenv

by AdrianLC ST3

Manage your virtualenvs directly from Sublime Text 3

Labels build system

Details

Installs

  • Total 6K
  • Win 2K
  • OS X 3K
  • Linux 2K
Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10
Windows 3 4 11 7 5 1 4 3 10 6 2 6 3 3 6 5 2 3 7 1 1 3 6 8 8 5 2 3 4 4 1 1 1 1 4 6 4 4 3 3 4 1 2 5 3 4
OS X 2 2 4 5 2 10 8 9 8 14 7 5 3 5 4 8 8 7 4 4 5 7 5 4 11 5 5 7 10 5 8 3 3 4 7 8 6 8 6 6 5 1 12 8 2 7
Linux 5 6 3 8 5 7 4 8 8 8 2 5 2 5 5 4 2 4 7 2 3 2 7 10 3 7 4 6 2 3 3 3 4 6 4 4 6 4 7 2 3 3 4 4 10 6

Readme

Source
raw.​githubusercontent.​com

Sublime Text - Virtualenv

Manage your virtualenvs directly from Sublime Text 3.

Features

  • 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.

Support

Only Sublime Text 3. Tested in Linux and Windows but it should work in OS X as well.

Installation

Install through Package Control as usual:

  1. Open command palette through the menu or with Ctrl+Shift+P.
  2. Select Package Control: Install Package.
  3. Search Virtualenv and press enter.

Detailed instructions here.

Usage

Code Execution

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.

Activate

Search Virtualenv: Activate in the command palette and select the desired virtualenv.

Deactivate

The command Virtualenv: Deactivate is available when a virtualenv is activated.

Creating a virtualenv

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.

Deleting a virtualenv

Use the command Virtualenv: Remove, choose a virtualenv and confirm.

Integrations

Launch a Python REPL using the current virtualenv with the command Virtualenv: SublimeREPL - Python.

Settings

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.

executable

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.

virtualenv_directories

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.

extra_paths

Additional paths searched for python binaries. It might be useful in case of portable python installations. Defaults to none.

Advanced

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.

Future plans

Just some ideas for possible improvements.

  • Integration with more packages. Paths for SublimeCodeIntel?
  • Brother package for pip commands.