|
| 1 | +.. virtualenvwrapper documentation master file, created by |
| 2 | + sphinx-quickstart on Thu May 28 22:35:13 2009. |
| 3 | + You can adapt this file completely to your liking, but it should at least |
| 4 | + contain the root `toctree` directive. |
| 5 | +
|
| 6 | +########################### |
| 7 | +virtualenvwrapper |release| |
| 8 | +########################### |
| 9 | + |
| 10 | +virtualenvwrapper es un conjunto de extensiones de la herramienta de Ian |
| 11 | +Bicking `virtualenv <http://pypi.python.org/pypi/virtualenv>`_. Las extensiones |
| 12 | +incluyen funciones para la creación y eliminación de entornos virtuales y por otro |
| 13 | +lado administración de tu rutina de desarrollo, haciendo fácil trabajar en más |
| 14 | +de un proyecto al mismo tiempo sin introducir conflictos entre sus dependencias. |
| 15 | + |
| 16 | +=============== |
| 17 | +Características |
| 18 | +=============== |
| 19 | + |
| 20 | +1. Organiza todos tus entornos virtuales en un sólo lugar |
| 21 | +2. Funciones para administrar tus entornor virtuales (crear, eliminar, copiar). |
| 22 | +3. Usa un sólo comando para cambiar entre los entornos. |
| 23 | +4. Completa con tab los comandos que toman un entorno virtual como argumento. |
| 24 | +5. Ganchos configurables para todas las operaciones (ver :ref:`scripts`). |
| 25 | +6. Sistema de plugins para la creación de extensiones compartibles (ver |
| 26 | +:ref:`plugins`). |
| 27 | + |
| 28 | +============ |
| 29 | +Introducción |
| 30 | +============ |
| 31 | + |
| 32 | +La mejor forma de explicar las características que virtualenvwrapper brinda es |
| 33 | +mostrar éste en uso. |
| 34 | + |
| 35 | +Primero, algunos pasos de inicialización. La mayoría de esto sólo necesita ser |
| 36 | +hecho una sóla vez. Vas a querer agregar el comando ``source |
| 37 | +/usr/local/bin/virtualenvwrapper.sh`` al archivo de inicio de shell, cambiando |
| 38 | +el path hacia virtualenvwrapper.sh dependiendo en dónde haya sido instalado por |
| 39 | +pip. |
| 40 | + |
| 41 | +:: |
| 42 | + |
| 43 | + $ pip install virtualenvwrapper |
| 44 | + ... |
| 45 | + $ export WORKON_HOME=~/Envs |
| 46 | + $ mkdir -p $WORKON_HOME |
| 47 | + $ source /usr/local/bin/virtualenvwrapper.sh |
| 48 | + $ mkvirtualenv env1 |
| 49 | + Installing |
| 50 | + distribute.......................................... |
| 51 | + .................................................... |
| 52 | + .................................................... |
| 53 | + ...............................done. |
| 54 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/predeactivate |
| 55 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postdeactivate |
| 56 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/preactivate |
| 57 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postactivate New python executable in env1/bin/python |
| 58 | + (env1)$ ls $WORKON_HOME |
| 59 | + env1 hook.log |
| 60 | + |
| 61 | +Ahora podemos instalar algún software dentro del entorno. |
| 62 | + |
| 63 | +:: |
| 64 | + |
| 65 | + (env1)$ pip install django |
| 66 | + Downloading/unpacking django |
| 67 | + Downloading Django-1.1.1.tar.gz (5.6Mb): 5.6Mb downloaded |
| 68 | + Running setup.py egg_info for package django |
| 69 | + Installing collected packages: django |
| 70 | + Running setup.py install for django |
| 71 | + changing mode of build/scripts-2.6/django-admin.py from 644 to 755 |
| 72 | + changing mode of /Users/dhellmann/Envs/env1/bin/django-admin.py to 755 |
| 73 | + Successfully installed django |
| 74 | + |
| 75 | +Podemos ver el nuevo paquete instalado con ``lssitepackages``:: |
| 76 | + |
| 77 | + (env1)$ lssitepackages |
| 78 | + Django-1.1.1-py2.6.egg-info easy-install.pth |
| 79 | + distribute-0.6.10-py2.6.egg pip-0.6.3-py2.6.egg |
| 80 | + django setuptools.pth |
| 81 | + |
| 82 | +Por supuesto que no estamos limitados a un sólo virtualenv:: |
| 83 | + |
| 84 | + (env1)$ ls $WORKON_HOME |
| 85 | + env1 hook.log |
| 86 | + (env1)$ mkvirtualenv env2 |
| 87 | + Installing distribute............................... |
| 88 | + .................................................... |
| 89 | + .................................................... |
| 90 | + ........... ...............................done. |
| 91 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/predeactivate |
| 92 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postdeactivate |
| 93 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/preactivate |
| 94 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postactivate New python executable in env2/bin/python |
| 95 | + (env2)$ ls $WORKON_HOME |
| 96 | + env1 env2 hook.log |
| 97 | + |
| 98 | +Cambiar entre entornos con ``workon``:: |
| 99 | + |
| 100 | + (env2)$ workon env1 |
| 101 | + (env1)$ echo $VIRTUAL_ENV |
| 102 | + /Users/dhellmann/Envs/env1 |
| 103 | + (env1)$ |
| 104 | + |
| 105 | +El comando ``workon`` también incluye la completación con tab para los nombres |
| 106 | +de los entornos, e invoca a los scripts customizados cuando un entorno es |
| 107 | +activado o desactivado (ver :ref:`scripts`). |
| 108 | + |
| 109 | +:: |
| 110 | + |
| 111 | + (env1)$ echo 'cd $VIRTUAL_ENV' >> $WORKON_HOME/postactivate |
| 112 | + (env1)$ workon env2 |
| 113 | + (env2)$ pwd |
| 114 | + /Users/dhellmann/Envs/env2 |
| 115 | + |
| 116 | +:ref:`scripts-postmkvirtualenv` es ejecutado cuando un nuevo entorno es creado, |
| 117 | +dejándote instalar automáticamente herramientas comunmente utilizadas. |
| 118 | + |
| 119 | +:: |
| 120 | + |
| 121 | + (env2)$ echo 'pip install sphinx' >> $WORKON_HOME/postmkvirtualenv |
| 122 | + (env3)$ mkvirtualenv env3 |
| 123 | + New python executable in env3/bin/python |
| 124 | + Installing distribute............................... |
| 125 | + .................................................... |
| 126 | + .................................................... |
| 127 | + ........... ...............................done. |
| 128 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/predeactivate |
| 129 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postdeactivate |
| 130 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/preactivate |
| 131 | + virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postactivate |
| 132 | + Downloading/unpacking sphinx |
| 133 | + Downloading Sphinx-0.6.5.tar.gz (972Kb): 972Kb downloaded |
| 134 | + Running setup.py egg_info for package sphinx |
| 135 | + no previously-included directories found matching 'doc/_build' |
| 136 | + Downloading/unpacking Pygments>=0.8 (from sphinx) |
| 137 | + Downloading Pygments-1.3.1.tar.gz (1.1Mb): 1.1Mb downloaded |
| 138 | + Running setup.py egg_info for package Pygments |
| 139 | + Downloading/unpacking Jinja2>=2.1 (from sphinx) |
| 140 | + Downloading Jinja2-2.4.tar.gz (688Kb): 688Kb downloaded |
| 141 | + Running setup.py egg_info for package Jinja2 |
| 142 | + warning: no previously-included files matching '*' found under directory 'docs/_build/doctrees' |
| 143 | + Downloading/unpacking docutils>=0.4 (from sphinx) |
| 144 | + Downloading docutils-0.6.tar.gz (1.4Mb): 1.4Mb downloaded |
| 145 | + Running setup.py egg_info for package docutils |
| 146 | + Installing collected packages: docutils, Jinja2, Pygments, sphinx |
| 147 | + Running setup.py install for docutils |
| 148 | + Running setup.py install for Jinja2 |
| 149 | + Running setup.py install for Pygments |
| 150 | + Running setup.py install for sphinx |
| 151 | + no previously-included directories found matching 'doc/_build' |
| 152 | + Installing sphinx-build script to /Users/dhellmann/Envs/env3/bin |
| 153 | + Installing sphinx-quickstart script to /Users/dhellmann/Envs/env3/bin |
| 154 | + Installing sphinx-autogen script to /Users/dhellmann/Envs/env3/bin |
| 155 | + Successfully installed docutils Jinja2 Pygments sphinx (env3)$ |
| 156 | + (venv3)$ which sphinx-build |
| 157 | + /Users/dhellmann/Envs/env3/bin/sphinx-build |
| 158 | + |
| 159 | +A través de una combinación de funciones existentes definidas por el "core" |
| 160 | +package (see :ref:`command`), plugins de terceros (see |
| 161 | +:ref:`plugins`), y scripts definidos por el usuario (see :ref:`scripts`) |
| 162 | +virtualenvwrapper brinda una amplia variedad de oportunidades para automatizar |
| 163 | +tareas repetitivas. |
| 164 | + |
| 165 | +======== |
| 166 | +Detalles |
| 167 | +======== |
| 168 | + |
| 169 | +.. toctree:: |
| 170 | + :maxdepth: 2 |
| 171 | + |
| 172 | + install |
| 173 | + command_ref |
| 174 | + hooks |
| 175 | + tips |
| 176 | + developers |
| 177 | + extensions |
| 178 | + history |
| 179 | + |
| 180 | +.. _references: |
| 181 | + |
| 182 | +=========== |
| 183 | +Referencias |
| 184 | +=========== |
| 185 | + |
| 186 | +`virtualenv <http://pypi.python.org/pypi/virtualenv>`_, de Ian |
| 187 | +Bicking, es un pre-requisito para usar estas extensiones. |
| 188 | + |
| 189 | +Para más detalles, referirse a la columna que escribí para la revista de |
| 190 | +python (Python Magazine) en Mayo de 2008: `virtualenvwrapper | And Now For Something |
| 191 | +Completely Different |
| 192 | +<http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_. |
| 193 | + |
| 194 | +Rich Leland ha grabado un pequeño `screencast |
| 195 | +<http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/>`__ |
| 196 | +mostrando las características de virtualenvwrapper. |
| 197 | + |
| 198 | +======== |
| 199 | +Licencia |
| 200 | +======== |
| 201 | + |
| 202 | +Copyright Doug Hellmann, All Rights Reserved |
| 203 | + |
| 204 | +Permission to use, copy, modify, and distribute this software and its |
| 205 | +documentation for any purpose and without fee is hereby granted, |
| 206 | +provided that the above copyright notice appear in all copies and that |
| 207 | +both that copyright notice and this permission notice appear in |
| 208 | +supporting documentation, and that the name of Doug Hellmann not be |
| 209 | +used in advertising or publicity pertaining to distribution of the |
| 210 | +software without specific, written prior permission. |
| 211 | + |
| 212 | +DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 213 | +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 214 | +EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 215 | +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF |
| 216 | +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 217 | +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 218 | +PERFORMANCE OF THIS SOFTWARE. |
0 commit comments