File: index.rst

package info (click to toggle)
virtualenvwrapper 3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,140 kB
  • sloc: sh: 3,801; python: 991; makefile: 27
file content (355 lines) | stat: -rw-r--r-- 14,486 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
.. virtualenvwrapper documentation master file, created by
   sphinx-quickstart on Thu May 28 22:35:13 2009.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

###########################
virtualenvwrapper |release|
###########################

..
    virtualenvwrapper is a set of extensions to Ian Bicking's `virtualenv
    <http://pypi.python.org/pypi/virtualenv>`_ tool.  The extensions
    include wrappers for creating and deleting virtual environments and
    otherwise managing your development workflow, making it easier to work
    on more than one project at a time without introducing conflicts in
    their dependencies.

virtualenvwrapper は Ian Bicking の `virtualenv <http://pypi.python.org/pypi/virtualenv>`_ ツールの拡張機能です。この拡張機能は仮想環境の作成・削除を行ったり、開発ワークフローを管理するラッパーを提供します。このラッパーを使うことで、開発環境の依存関係による競合を起こさず、同時に複数のプロジェクトで作業しやすくなります。

..
    ========
    Features
    ========

====
機能
====

..
    1. Organizes all of your virtual environments in one place.
    2. Wrappers for managing your virtual environments (create, delete,
       copy).
    3. Use a single command to switch between environments.
    4. Tab completion for commands that take a virtual environment as
       argument.
    5. User-configurable hooks for all operations (see :ref:`scripts`).
    6. Plugin system for more creating sharable extensions (see
       :ref:`plugins`).

1. 1つの場所に全ての仮想環境を構成する
2. 仮想環境を管理(作成、削除、コピー)するラッパー
3. 1つのコマンドで仮想環境を切り替える
4. コマンドの引数から仮想環境をタブ補完できる
5. 全ての操作をユーザ設定でフックできる(:ref:`scripts` を参照)
6. 共有できる拡張機能を作成できるプラグインシステム(:ref:`plugins` を参照)

..
    ============
    Introduction
    ============

====
入門
====

..
    The best way to explain the features virtualenvwrapper gives you is to
    show it in use.

virtualenvwrapper が提供する機能を説明するには、実際に使ってみるのが最も良い方法です。

..
    First, some initialization steps.  Most of this only needs to be done
    one time.  You will want to add the command to ``source
    /usr/local/bin/virtualenvwrapper.sh`` to your shell startup file,
    changing the path to virtualenvwrapper.sh depending on where it was
    installed by pip.

まず初期化の作業があります。この作業の大半は一度だけ行う必要があります。pip でインストールした場所に依存する virtualenvwrapper.sh のパスを変更したり、 ``source /usr/local/bin/virtualenvwrapper.sh`` のコマンドをシェル起動時に読み込まれるファイルへ追加したりするでしょう。

::

  $ pip install virtualenvwrapper
  ...
  $ export WORKON_HOME=~/Envs
  $ mkdir -p $WORKON_HOME
  $ source /usr/local/bin/virtualenvwrapper.sh
  $ mkvirtualenv env1
  Installing
  distribute..........................................
  ....................................................
  ....................................................
  ...............................done.
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/predeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postdeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/preactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env1/bin/postactivate  New python executable in env1/bin/python
  (env1)$ ls $WORKON_HOME
  env1 hook.log

..
    Now we can install some software into the environment.

これで作成した仮想環境へソフトウェアをインストールできます。

::

  (env1)$ pip install django
  Downloading/unpacking django
    Downloading Django-1.1.1.tar.gz (5.6Mb): 5.6Mb downloaded
    Running setup.py egg_info for package django
  Installing collected packages: django
    Running setup.py install for django
      changing mode of build/scripts-2.6/django-admin.py from 644 to 755
      changing mode of /Users/dhellmann/Envs/env1/bin/django-admin.py to 755
  Successfully installed django

..
    We can see the new package with ``lssitepackages``

``lssitepackages`` で新たにインストールしたパッケージを調べられます。

::

  (env1)$ lssitepackages
  Django-1.1.1-py2.6.egg-info     easy-install.pth
  distribute-0.6.10-py2.6.egg     pip-0.6.3-py2.6.egg
  django                          setuptools.pth

..
    Of course we are not limited to a single virtualenv

当然、1つだけの仮想環境に制限されるわけではりません。

::

  (env1)$ ls $WORKON_HOME
  env1            hook.log
  (env1)$ mkvirtualenv env2
  Installing distribute...............................
  ....................................................
  ....................................................
  ........... ...............................done.
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/predeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postdeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/preactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env2/bin/postactivate  New python executable in env2/bin/python
  (env2)$ ls $WORKON_HOME
  env1            env2            hook.log

..
    Switch between environments with ``workon``

``workon`` で仮想環境を切り替えます。

::

  (env2)$ workon env1
  (env1)$ echo $VIRTUAL_ENV
  /Users/dhellmann/Envs/env1
  (env1)$ 

..
    The ``workon`` command also includes tab completion for the
    environment names, and invokes customization scripts as an environment
    is activated or deactivated (see :ref:`scripts`).

さらに ``workon`` コマンドは仮想環境名をタブ補完できます。そして、ある仮想環境がアクティブ化または非アクティブ化されるようにカスタムスクリプトを実行します(:ref:`scripts` を参照)。

::

  (env1)$ echo 'cd $VIRTUAL_ENV' >> $WORKON_HOME/postactivate
  (env1)$ workon env2
  (env2)$ pwd
  /Users/dhellmann/Envs/env2

..
    :ref:`scripts-postmkvirtualenv` is run when a new environment is
    created, letting you automatically install commonly-used tools.

新たな環境が作成されるときに :ref:`scripts-postmkvirtualenv` が実行されて、一般的に使用するツールを自動的にインストールします。

::

  (env2)$ echo 'pip install sphinx' >> $WORKON_HOME/postmkvirtualenv
  (env3)$ mkvirtualenv env3
  New python executable in env3/bin/python
  Installing distribute...............................
  ....................................................
  ....................................................
  ........... ...............................done.
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/predeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postdeactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/preactivate
  virtualenvwrapper.user_scripts Creating /Users/dhellmann/Envs/env3/bin/postactivate
  Downloading/unpacking sphinx
    Downloading Sphinx-0.6.5.tar.gz (972Kb): 972Kb downloaded
    Running setup.py egg_info for package sphinx
      no previously-included directories found matching 'doc/_build'
  Downloading/unpacking Pygments>=0.8 (from sphinx)
    Downloading Pygments-1.3.1.tar.gz (1.1Mb): 1.1Mb downloaded
    Running setup.py egg_info for package Pygments
  Downloading/unpacking Jinja2>=2.1 (from sphinx)
    Downloading Jinja2-2.4.tar.gz (688Kb): 688Kb downloaded
    Running setup.py egg_info for package Jinja2
      warning: no previously-included files matching '*' found under directory 'docs/_build/doctrees'
  Downloading/unpacking docutils>=0.4 (from sphinx)
    Downloading docutils-0.6.tar.gz (1.4Mb): 1.4Mb downloaded
    Running setup.py egg_info for package docutils
  Installing collected packages: docutils, Jinja2, Pygments, sphinx
    Running setup.py install for docutils
    Running setup.py install for Jinja2
    Running setup.py install for Pygments
    Running setup.py install for sphinx
      no previously-included directories found matching 'doc/_build'
      Installing sphinx-build script to /Users/dhellmann/Envs/env3/bin
      Installing sphinx-quickstart script to /Users/dhellmann/Envs/env3/bin
      Installing sphinx-autogen script to /Users/dhellmann/Envs/env3/bin
  Successfully installed docutils Jinja2 Pygments sphinx  (env3)$ 
  (venv3)$ which sphinx-build
  /Users/dhellmann/Envs/env3/bin/sphinx-build

..
    Through a combination of the existing functions defined by the core
    package (see :ref:`command`), third-party plugins (see
    :ref:`plugins`), and user-defined scripts (see :ref:`scripts`)
    virtualenvwrapper gives you a wide variety of opportunities to
    automate repetitive operations.

コアパッケージで定義された既存機能(:ref:`command` を参照)、サードパーティのプラグイン(:ref:`plugins` を参照)やユーザ定義スクリプト(:ref:`scripts` を参照)を組み合わせて、virtualenvwrapper は雑多な繰り返し行う操作を自動化する機会を提供します。

..
    =======
    Details
    =======

========
詳細内容
========

.. toctree::
   :maxdepth: 2

   install
   command_ref
   hooks
   projects
   tips
   developers
   extensions
   history

.. _references:

..
    ==========
    References
    ==========

========
参考文献
========

..
    `virtualenv <http://pypi.python.org/pypi/virtualenv>`_, from Ian
    Bicking, is a pre-requisite to using these extensions.

Ian Bicking の `virtualenv <http://pypi.python.org/pypi/virtualenv>`_ が virtualenvwrapper の拡張機能を使用するために必須です。

..
    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>`_.

さらに詳細は私が書いた2008年5月の Python マガジンのコラムを参照してください。
`virtualenvwrapper | ところで話は変わりますが
<http://www.doughellmann.com/articles/CompletelyDifferent-2008-05-virtualenvwrapper/index.html>`_

..
    Rich Leland has created a short `screencast
    <http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/>`__
    showing off the features of virtualenvwrapper.

Rich Leland は virtualenvwrapper の機能を誇示するために短い `スクリーンキャスト <http://mathematism.com/2009/jul/30/presentation-pip-and-virtualenv/>`__ を作成しました。

..
    Manuel Kaufmann has `translated this documentation into Spanish
    <http://www.doughellmann.com/docs/virtualenvwrapper/es/>`__.

Manuel Kaufmann は `このドキュメントをスペイン語に翻訳しました <http://www.doughellmann.com/docs/virtualenvwrapper/es/>`__ 。

..
    Tetsuya Morimoto has `translated this documentation into Japanese
    <http://www.doughellmann.com/docs/virtualenvwrapper/ja/>`__.

Tetsuya Morimoto は `このドキュメントを日本語に翻訳しました <http://www.doughellmann.com/docs/virtualenvwrapper/ja/>`__ 。

..
    =======
    Support
    =======

========
サポート
========

..
    Join the `virtualenvwrapper Google Group
    <http://groups.google.com/group/virtualenvwrapper/>`__ to discuss
    issues and features.  

問題や機能を議論するには `virtualenvwrapper Google Group <http://groups.google.com/group/virtualenvwrapper/>`__ に参加してください。

..
    Report bugs via the `bug tracker on BitBucket
    <http://bitbucket.org/dhellmann/virtualenvwrapper/>`__.

`BitBucket のバグトラッカー <http://bitbucket.org/dhellmann/virtualenvwrapper/>`__ でバグを報告してください。

..
    Shell Aliases
    =============

シェルエイリアス
================

..
    Since virtualenvwrapper is largely a shell script, it uses shell
    commands for a lot of its actions.  If your environment makes heavy
    use of shell aliases or other customizations, you may encounter
    issues.  Before reporting bugs in the bug tracker, please test
    *without* your aliases enabled.  If you can identify the alias causing
    the problem, that will help make virtualenvwrapper more robust.

virtualenvwrapper は大きなシェルスクリプトなので、多くのアクションはシェルコマンドを使用します。あなたの環境が多くのシェルエイリアスやその他のカスタマイズを行っているなら、何かしら問題に遭遇する可能性があります。バグトラッカーにバグを報告する前に、そういったエイリアスを無効な *状態* でテストしてください。あなたがその問題を引き起こすエイリアスを判別できるなら virtualenvwrapper をもっと堅牢なものにすることに役立つでしょう。

..
    =======
    License
    =======

.. _license:

==========
ライセンス
==========

Copyright Doug Hellmann, All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Doug Hellmann not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.