Skip to content

Commit 7e3b364

Browse files
committed
Make virtualenvs conform to the style guide a bit more. Plus some additional changes
1 parent 291ab64 commit 7e3b364

File tree

1 file changed

+43
-20
lines changed

1 file changed

+43
-20
lines changed

docs/dev/virtualenvs.rst

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,37 @@ virtualenv
1414
`virtualenv <http://pypi.python.org/pypi/virtualenv>`_ is a tool to create
1515
isolated Python environments.
1616

17-
Install it via pip::
17+
Install it via pip:
18+
19+
.. code-block:: console
1820
1921
$ pip install virtualenv
2022
2123
Basic Usage
2224
~~~~~~~~~~~
2325

24-
1. Create a virtual environment::
26+
1. Create a virtual environment:
27+
28+
.. code-block:: console
2529
26-
$ virtualenv ENVIRONMENT_NAME
30+
$ virtualenv venv
2731
2832
This creates a copy of Python in whichever directory you ran the command in,
29-
placing it in a folder named ``ENVIRONMENT_NAME``.
33+
placing it in a folder named ``venv``.
34+
35+
2. To begin using the virtual environment, it needs to be activated:
3036

31-
2. To begin using the virtual environment, it needs to be activated::
37+
.. code-block:: console
3238
33-
$ source ENVIRONMENT_NAME/bin/activate
39+
$ source venv/bin/activate
3440
3541
You can then begin installing any new modules without affecting the system
3642
default Python or other virtual environments.
3743

3844
3. If you are done working in the virtual environment for the moment, you can
39-
deactivate it::
45+
deactivate it:
46+
47+
.. code-block:: console
4048
4149
$ deactivate
4250
@@ -45,49 +53,64 @@ installed libraries.
4553

4654
To delete a virtual environment, just delete its folder.
4755

56+
After a while, though, you might end up with a lot of virtual environments
57+
littered across your system, and its possible you'll forget their names or
58+
where they were placed.
59+
4860
virtualenvwrapper
4961
-----------------
5062

5163
`virtualenvwrapper <http://www.doughellmann.com/projects/virtualenvwrapper/>`_
5264
provides a set of commands which makes working with virtual environments much
53-
more pleasant. It also places all your virtual environments into one place.
65+
more pleasant. It also places all your virtual environments in one place.
5466

55-
To install (make sure **virtualenv** is already installed)::
67+
To install (make sure **virtualenv** is already installed):
68+
69+
.. code-block:: console
5670
5771
$ pip install virtualenvwrapper
5872
$ export WORKON_HOME=~/Envs
5973
$ source /usr/local/bin/virtualenvwrapper.sh
6074
61-
(Full instructions `here <http://www.doughellmann.com/docs/virtualenvwrapper/#introduction>`_.)
75+
(`Full virtualenvwrapper install instructions <http://www.doughellmann.com/docs/virtualenvwrapper/#introduction>`_.)
6276

6377
Basic Usage
6478
~~~~~~~~~~~
6579

66-
1. Create a virtual environment::
80+
1. Create a virtual environment:
81+
82+
.. code-block:: console
83+
84+
$ mkvirtualenv venv
6785
68-
$ mkvirtualenv ENVIRONMENT_NAME
86+
This creates the ``venv`` folder inside ``~/Envs``.
6987

70-
This creates the ``ENVIRONMENT_NAME`` folder inside ``~/Envs``.
88+
2. Work on a virtual environment:
7189

72-
2. Work on a virtual environment::
90+
.. code-block:: console
7391
74-
$ workon ENVIRONMENT_NAME
92+
$ workon venv
7593
7694
**virtualenvwrapper** provides tab-completion on environment names. It really
7795
helps when you have a lot of environments and have trouble remembering their
7896
names.
7997
``workon`` also deactivates whatever environment you are currently in, so you
8098
can quickly switch between environments.
8199

82-
3. Deactivating is still the same::
100+
3. Deactivating is still the same:
101+
102+
.. code-block:: console
83103
84104
$ deactivate
85105
86-
4. To delete::
106+
4. To delete:
107+
108+
.. code-block:: console
87109
88-
$ rmvirtualenv ENVIRONMENT_NAME
110+
$ rmvirtualenv venv
89111
90-
Other nifty commands include:
112+
Other useful commands
113+
~~~~~~~~~~~~~~~~~~~~~
91114

92115
``lsvirtualenv``
93116
List all of the environments.
@@ -102,4 +125,4 @@ Other nifty commands include:
102125
``lssitepackages``
103126
Shows contents of ``site-packages`` directory.
104127

105-
A full list of commands can be found `here <http://www.doughellmann.com/docs/virtualenvwrapper/command_ref.html#managing-environments>`_.
128+
`Full list of virtualenvwrapper commands <http://www.doughellmann.com/docs/virtualenvwrapper/command_ref.html#managing-environments>`_.

0 commit comments

Comments
 (0)