You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/command_ref.rst
+35-20Lines changed: 35 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Syntax::
20
20
21
21
mkvirtualenv [options] ENVNAME
22
22
23
-
(where the options are passed directly to virtualenv)
23
+
(any options are passed directly to ``virtualenv``)
24
24
25
25
rmvirtualenv
26
26
------------
@@ -54,32 +54,38 @@ Syntax::
54
54
55
55
workon [environment_name]
56
56
57
-
If no ``environment_name`` is given the list of available environments is printed to stdout.
57
+
If no ``environment_name`` is given the list of available environments
58
+
is printed to stdout.
58
59
59
60
deactivate
60
61
----------
61
62
62
-
Switch from a virtual environment to the system-installed version of Python.
63
+
Switch from a virtual environment to the system-installed version of
64
+
Python.
63
65
64
66
Syntax::
65
67
66
68
deactivate
67
69
68
70
.. note::
69
71
70
-
This command is actually part of virtualenv, but is wrapped to provide before and after hooks, just as workon does for activate.
72
+
This command is actually part of virtualenv, but is wrapped to
73
+
provide before and after hooks, just as workon does for activate.
71
74
72
75
==================================
73
76
Quickly Navigating to a virtualenv
74
77
==================================
75
78
76
-
There are two functions to provide shortcuts to navigate into the the currently-active
77
-
virtualenv.
79
+
There are two functions to provide shortcuts to navigate into the the
80
+
currently-active virtualenv.
78
81
79
82
cdvirtualenv
80
83
------------
81
84
82
-
Calling ``cdvirtualenv`` changes the current working directory to the top of the virtualenv (``$VIRTUAL_ENV``). An optional argument is appended to the path, allowing navigation directly into a subdirectory.
85
+
Calling ``cdvirtualenv`` changes the current working directory to the
86
+
top of the virtualenv (``$VIRTUAL_ENV``). An optional argument is
87
+
appended to the path, allowing navigation directly into a
88
+
subdirectory.
83
89
84
90
::
85
91
@@ -96,10 +102,12 @@ Calling ``cdvirtualenv`` changes the current working directory to the top of the
96
102
cdsitepackages
97
103
--------------
98
104
99
-
Because the exact path to the site-packages directory in the virtualenv depends on the
100
-
version of Python, ``cdsitepackages`` is provided as a shortcut for ``cdvirtualenv
101
-
lib/python${pyvers}/site-packages``. An optional argument is also allowed, to specify
102
-
a directory hierarchy within the ``site-packages`` directory to change into.
105
+
Because the exact path to the site-packages directory in the
106
+
virtualenv depends on the version of Python, ``cdsitepackages`` is
107
+
provided as a shortcut for ``cdvirtualenv
108
+
lib/python${pyvers}/site-packages``. An optional argument is also
109
+
allowed, to specify a directory hierarchy within the ``site-packages``
110
+
directory to change into.
103
111
104
112
::
105
113
$ workon pymotw
@@ -113,7 +121,12 @@ a directory hierarchy within the ``site-packages`` directory to change into.
113
121
Path Management
114
122
===============
115
123
116
-
Sometimes it is desirable to share installed packages that are not in the system ``site-pacakges`` directory and which you do not want to install in each virtualenv. In this case, you *could* symlink the source into the environment ``site-packages`` directory, but it is also easy to add extra directories to the PYTHONPATH by including them in a .pth file inside ``site-packages`` using ``add2virtualenv``.
124
+
Sometimes it is desirable to share installed packages that are not in
125
+
the system ``site-pacakges`` directory and which you do not want to
126
+
install in each virtualenv. In this case, you *could* symlink the
127
+
source into the environment ``site-packages`` directory, but it is
128
+
also easy to add extra directories to the PYTHONPATH by including them
129
+
in a .pth file inside ``site-packages`` using ``add2virtualenv``.
117
130
118
131
1. Check out the source for a big project, such as Django.
119
132
2. Run: ``add2virtualenv path_to_source``.
@@ -123,22 +136,24 @@ Sometimes it is desirable to share installed packages that are not in the system
123
136
add2virtualenv
124
137
--------------
125
138
126
-
Adds the specified directories to the Python path for the currently-active
127
-
virtualenv.
139
+
Adds the specified directories to the Python path for the
140
+
currently-active virtualenv.
128
141
129
142
Syntax::
130
143
131
144
add2virtualenv directory1 directory2 ...
132
145
133
-
Path management for packages outside of the virtual env.
134
-
Based on a contribution from James Bennett and Jannis Leidel.
146
+
Path management for packages outside of the virtual env. Based on a
147
+
contribution from James Bennett and Jannis Leidel.
135
148
136
-
This will be done by placing the directory names in a path file
137
-
named ``virtualenv_path_extensions.pth`` inside the virtualenv's site-packages
138
-
directory; if this file does not exist, it will be created first.
149
+
This will be done by placing the directory names in a path file named
150
+
``virtualenv_path_extensions.pth`` inside the virtualenv's
151
+
site-packages directory; if this file does not exist, it will be
152
+
created first.
139
153
140
154
141
155
lssitepackages
142
156
--------------
143
157
144
-
Calling ``lssitepackages`` shows the content of the ``site-packages`` directory of the currently-active virtualenv.
158
+
Calling ``lssitepackages`` shows the content of the ``site-packages``
Copy file name to clipboardExpand all lines: docs/source/hooks.rst
+34-10Lines changed: 34 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,25 @@
2
2
Hook Scripts
3
3
============
4
4
5
-
virtualenvwrapper adds several hook points you can use to change your settings, shell environment, or other configuration values when creating, deleting, or moving between environments. They are either *sourced* (allowing them to modify your shell environment) or *run* as an external program at the appropriate trigger time.
5
+
virtualenvwrapper adds several hook points you can use to change your
6
+
settings, shell environment, or other configuration values when
7
+
creating, deleting, or moving between environments. They are either
8
+
*sourced* (allowing them to modify your shell environment) or *run* as
9
+
an external program at the appropriate trigger time.
6
10
7
11
Environment Hooks
8
12
=================
9
13
10
14
postactivate
11
15
------------
12
16
13
-
The ``$VIRTUAL_ENV/bin/postactivate`` script is sourced after the new environment is enabled. ``$VIRTUAL_ENV`` refers to the new environment at the time the script runs.
17
+
The ``$VIRTUAL_ENV/bin/postactivate`` script is sourced after the new
18
+
environment is enabled. ``$VIRTUAL_ENV`` refers to the new environment
19
+
at the time the script runs.
14
20
15
-
This example script for the PyMOTW environment changes the current working directory and the PATH variable to refer to the source tree containing the PyMOTW source.
21
+
This example script for the PyMOTW environment changes the current
22
+
working directory and the PATH variable to refer to the source tree
23
+
containing the PyMOTW source.
16
24
17
25
::
18
26
@@ -23,17 +31,24 @@ This example script for the PyMOTW environment changes the current working direc
23
31
predeactivate
24
32
-------------
25
33
26
-
The ``$VIRTUAL_ENV/bin/predeactivate`` script is sourced before the current environment is deactivated, and can be used to disable or clear settings in your environment. ``$VIRTUAL_ENV`` refers to the old environment at the time the script runs.
34
+
The ``$VIRTUAL_ENV/bin/predeactivate`` script is sourced before the
35
+
current environment is deactivated, and can be used to disable or
36
+
clear settings in your environment. ``$VIRTUAL_ENV`` refers to the old
37
+
environment at the time the script runs.
27
38
28
39
Global Hooks
29
40
============
30
41
31
42
postactivate
32
43
------------
33
44
34
-
The global ``$WORKON_HOME/postactivate`` script is sourced after the new environment is enabled and the new environment's postactivate is sourced (if it exists). ``$VIRTUAL_ENV`` refers to the new environment at the time the script runs.
45
+
The global ``$WORKON_HOME/postactivate`` script is sourced after the
46
+
new environment is enabled and the new environment's postactivate is
47
+
sourced (if it exists). ``$VIRTUAL_ENV`` refers to the new environment
48
+
at the time the script runs.
35
49
36
-
This example script adds a space between the virtual environment name and your old PS1 by making use of ``_OLD_VIRTUAL_PS1``.
50
+
This example script adds a space between the virtual environment name
51
+
and your old PS1 by making use of ``_OLD_VIRTUAL_PS1``.
37
52
38
53
::
39
54
@@ -42,19 +57,28 @@ This example script adds a space between the virtual environment name and your o
42
57
premkvirtualenv
43
58
---------------
44
59
45
-
The ``$WORKON_HOME/premkvirtualenv`` script is run as an external program after the virtual environment is created but before the current environment is switched to point to the new env. The current working directory for the script is ``$WORKON_HOME`` and the name of the new environment is passed as an argument to the script.
60
+
The ``$WORKON_HOME/premkvirtualenv`` script is run as an external
61
+
program after the virtual environment is created but before the
62
+
current environment is switched to point to the new env. The current
63
+
working directory for the script is ``$WORKON_HOME`` and the name of
64
+
the new environment is passed as an argument to the script.
46
65
47
66
postmkvirtualenv
48
67
----------------
49
68
50
-
The ``$WORKON_HOME/postmkvirtualenv`` script is sourced after the new environment is created and activated.
69
+
The ``$WORKON_HOME/postmkvirtualenv`` script is sourced after the new
70
+
environment is created and activated.
51
71
52
72
prermvirtualenv
53
73
---------------
54
74
55
-
The ``$WORKON_HOME/prermvirtualenv`` script is run as an external program before the environment is removed. The full path to the environment directory is passed as an argument to the script.
75
+
The ``$WORKON_HOME/prermvirtualenv`` script is run as an external
76
+
program before the environment is removed. The full path to the
77
+
environment directory is passed as an argument to the script.
56
78
57
79
postrmvirtualenv
58
80
----------------
59
81
60
-
The ``$WORKON_HOME/postrmvirtualenv`` script is run as an external program after the environment is removed. The full path to the environment directory is passed as an argument to the script.
82
+
The ``$WORKON_HOME/postrmvirtualenv`` script is run as an external
83
+
program after the environment is removed. The full path to the
84
+
environment directory is passed as an argument to the script.
0 commit comments