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: README
+47-16Lines changed: 47 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -28,31 +28,59 @@ Sometimes it is desirable to share installed packages that are not in the system
28
28
3. Run: ``add2virtualenv``.
29
29
4. A usage message and list of current "extra" paths is printed.
30
30
31
-
==================
32
-
Activation Scripts
33
-
==================
34
-
35
-
virtualenvwrapper adds two separate hook scripts you can use to change your settings when moving between environments. They are *sourced* by ``workon`` at the appropriate trigger time, allowing them to modify your shell environment.
31
+
============
32
+
Hook Scripts
33
+
============
36
34
37
-
Both scripts are bash shell scripts and need to be saved in ``$VIRTUAL_ENV/bin/``.
35
+
virtualenvwrapper adds several hook points you can use to change your settings when creating,
36
+
deleting, or moving between environments. They are either *sourced* (allowing them to modify
37
+
your shell environment) or run as an external program at the appropriate trigger time.
38
38
39
-
postactivate
40
-
============
39
+
$VIRTUAL_ENV/bin/postactivate
40
+
=============================
41
41
42
-
The ``postactivate`` script is run after the new environment is enabled. ``$VIRTUAL_ENV`` refers to the new environment at the time the script runs.
42
+
The ``postactivate`` script is sourced after the new environment is enabled. ``$VIRTUAL_ENV``
43
+
refers to the new environment at the time the script runs.
43
44
44
-
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.
45
+
This example script for the PyMOTW environment changes the current working directory and the
46
+
PATH variable to refer to the source tree containing the PyMOTW source.
45
47
46
48
::
47
49
48
-
pymotw_root=/Users/dhellmann/Documents/PyMOTW
49
-
cd $pymotw_root
50
-
PATH=$pymotw_root/bin:$PATH
50
+
pymotw_root=/Users/dhellmann/Documents/PyMOTW
51
+
cd $pymotw_root
52
+
PATH=$pymotw_root/bin:$PATH
53
+
54
+
$VIRTUAL_ENV/bin/predeactivate
55
+
==============================
56
+
57
+
The ``predeactivate`` script is source before the current environment is deactivated, and can
58
+
be used to disable or clear settings in your environment. ``$VIRTUAL_ENV`` refers to the old
59
+
environment at the time the script runs.
60
+
61
+
$WORKON_HOME/premkvirtualenv
62
+
=============================
51
63
52
-
predeactivate
53
-
=============
64
+
The ``premkvirtualenv`` script is run as an external program after the virtual environment is
65
+
created but before the current environment is switched to point to the new env. The current
66
+
working directory for the script is ``$WORKON_HOME`` and the name of the new environment is
67
+
passed as an argument to the script.
54
68
55
-
The ``predeactivate`` script is run 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.
69
+
$WORKON_HOME/postmkvirtualenv
70
+
=============================
71
+
72
+
The ``postmkvirtualenv`` script is sourced after the new environment is created and
73
+
activated.
74
+
75
+
$WORKON_HOME/prermvirtualenv
76
+
============================
77
+
78
+
The ``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.
79
+
80
+
$WORKON_HOME/postrmvirtualenv
81
+
=============================
82
+
83
+
The ``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.
56
84
57
85
===============
58
86
Path Management
@@ -70,6 +98,9 @@ For more details, refer to the column I wrote for the May 2008 issue of Python M
70
98
Updates
71
99
=======
72
100
101
+
1.9
102
+
- Add more hooks for operations to run before and after creating or deleting environments based on changes from Chris Hasenpflug.
103
+
73
104
1.8.1
74
105
- Corrected a problem with change to mkvirtualenv that lead to release 1.8 by using an alternate fix proposed by James in comments on release 1.4.
0 commit comments