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
+51-1Lines changed: 51 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,58 @@ 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.
36
+
37
+
Both scripts are bash shell scripts and need to be saved in ``$VIRTUAL_ENV/bin/``.
38
+
39
+
postactivate
40
+
============
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.
43
+
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
+
46
+
::
47
+
48
+
pymotw_root=/Users/dhellmann/Documents/PyMOTW
49
+
cd $pymotw_root
50
+
PATH=$pymotw_root/bin:$PATH
51
+
52
+
predeactivate
53
+
=============
54
+
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.
56
+
57
+
===============
58
+
Path Management
59
+
===============
60
+
61
+
The function ``add2virtualenv`` adds the specified directories to the Python path for the active virtualenv. The directory names passed as argument are added to a path file named ``virtualenv_path_extensions.pth`` inside the virtualenv's site-packages directory. If this file does not exist, it will be created first.
62
+
31
63
==========
32
64
References
33
65
==========
34
66
35
-
For more details, refer to the column I wrote for the May 2008 issue of Python Magazine: `virtualenvwrapper | And Now For Something Completely Different <http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_.
67
+
For more details, refer to the column I wrote for the May 2008 issue of Python Magazine: `virtualenvwrapper | And Now For Something Completely Different <http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_.
68
+
69
+
=======
70
+
Updates
71
+
=======
72
+
73
+
1.5
74
+
75
+
- Fix some issues with spaces in directory or env names. They still don't really work with virtualenv, though.
76
+
- Added documentation for the postactivate and predeactivate scripts.
77
+
78
+
1.4
79
+
80
+
- Includes a new .pth management function based on work contributed by James Bennett and Jannis Leidel.
81
+
82
+
1.3.x
83
+
84
+
- Includes a fix for a nasty bug in rmvirtualenv identified by John Shimek.
0 commit comments