@@ -10,7 +10,7 @@ Virtualenv has one basic command:
10
10
11
11
virtualenv venv
12
12
13
- This will create a python virtual environment of the same version as virtualenv is installed into under path
13
+ This will create a python virtual environment of the same version as virtualenv, installed into the subdirectory
14
14
``venv ``. The command line tool has quite a few of flags that modify the tool's behaviour, for a
15
15
full list make sure to check out :ref: `cli_flags `.
16
16
@@ -24,7 +24,7 @@ The tool works in two phases:
24
24
- create a python that matches the target python interpreter from phase 1,
25
25
- install (bootstrap) seed packages (one or more of :pypi: `pip `, :pypi: `setuptools `, :pypi: `wheel `) in the created
26
26
virtual environment,
27
- - install activation scripts into the binary directory of the virtual environment (these will allow end user to
27
+ - install activation scripts into the binary directory of the virtual environment (these will allow end users to
28
28
*activate * the virtual environment from various shells).
29
29
- create files that mark the virtual environment as to be ignored by version control systems (currently we support
30
30
Git only, as Mercurial, Bazaar or SVN do not support ignore files in subdirectories). This step can be skipped
@@ -40,17 +40,17 @@ The first thing we need to be able to create a virtual environment is a python i
40
40
tool what type of virtual environment you would like to create, think of it as: version, architecture, implementation.
41
41
42
42
``virtualenv `` being a python application has always at least one such available, the one ``virtualenv `` itself is
43
- using it , and as such this is the default discovered element. This means that if you install ``virtualenv `` under
43
+ using, and as such this is the default discovered element. This means that if you install ``virtualenv `` under
44
44
python ``3.8 ``, virtualenv will by default create virtual environments that are also of version ``3.8 ``.
45
45
46
46
Created python virtual environments are usually not self-contained. A complete python packaging is usually made up of
47
- thousand of files, so it's not efficient to install the entire python again into a new folder. Instead virtual
48
- environments are mere shells, that contain little within itself , and borrow most from the system python (this is what
47
+ thousands of files, so it's not efficient to install the entire python again into a new folder. Instead virtual
48
+ environments are mere shells, that contain little within themselves , and borrow most from the system python (this is what
49
49
you installed, when you installed python itself). This does mean that if you upgrade your system python your virtual
50
- environments *might * break, so watch out. The upside of this referring to the system python is that creating virtual
50
+ environments *might * break, so watch out. The upside of this, referring to the system python, is that creating virtual
51
51
environments can be fast.
52
52
53
- Here we'll describe the builtin mechanism (note this can be extended though by plugins). The CLI flag :option: `p ` or
53
+ Here we'll describe the built-in mechanism (note this can be extended though by plugins). The CLI flag :option: `p ` or
54
54
:option: `python ` allows you to specify a python specifier for what type of virtual environment you would like, the
55
55
format is either:
56
56
@@ -87,14 +87,14 @@ format is either:
87
87
88
88
.. warning ::
89
89
90
- As detailed above virtual environments usually just borrow things from the system Python, they don't actually contain
90
+ As detailed above, virtual environments usually just borrow things from the system Python, they don't actually contain
91
91
all the data from the system Python. The version of the python executable is hardcoded within the python exe itself.
92
- Therefore if you upgrade your system Python, your virtual environment will still report the version before the
92
+ Therefore, if you upgrade your system Python, your virtual environment will still report the version before the
93
93
upgrade, even though now other than the executable all additional content (standard library, binary libs, etc) are
94
94
of the new version.
95
95
96
- Baring any major incompatibilities (rarely the case) the virtual environment will continue working, but other than
97
- the content embedded within the python executable it will behave like the upgraded version. If a such virtual
96
+ Barring any major incompatibilities (rarely the case) the virtual environment will continue working, but other than
97
+ the content embedded within the python executable it will behave like the upgraded version. If such a virtual
98
98
environment python is specified as the target python interpreter, we will create virtual environments that match the
99
99
new system Python version, not the version reported by the virtual environment.
100
100
@@ -110,14 +110,14 @@ at the moment has two types of virtual environments:
110
110
virtualenv is installed in the system python), which can be an expensive operation (especially true on Windows).
111
111
112
112
- ``builtin `` - this means ``virtualenv `` is able to do the creation operation itself (by knowing exactly what files to
113
- create and what system files needs to be referenced). The creator with name ``builtin `` is an alias on the first
113
+ create and what system files need to be referenced). The creator with name ``builtin `` is an alias on the first
114
114
creator that's of this type (we provide creators for various target environments, that all differ in actual create
115
115
operations, such as CPython 2 on Windows, PyPy2 on Windows, CPython3 on Posix, PyPy3 on Posix, and so on; for a full
116
116
list see :option: `creator `).
117
117
118
118
Seeders
119
119
-------
120
- These will install for you some seed packages (one or more of the : :pypi: `pip `, :pypi: `setuptools `, :pypi: `wheel `) that
120
+ These will install for you some seed packages (one or more of: :pypi: `pip `, :pypi: `setuptools `, :pypi: `wheel `) that
121
121
enables you to install additional python packages into the created virtual environment (by invoking pip). There are two
122
122
main seed mechanism available:
123
123
@@ -128,7 +128,7 @@ main seed mechanism available:
128
128
library path (the ``site-packages `` folder). This allows all but the first virtual environment creation to be blazing
129
129
fast (a ``pip `` mechanism takes usually 98% of the virtualenv creation time, so by creating this install image that
130
130
we can just link into the virtual environments install directory we can achieve speedups of shaving the initial
131
- 1 minutes 10 seconds down to just 8 seconds in case of copy, or ``0.8 `` seconds in case symlinks are available -
131
+ 1 minute and 10 seconds down to just 8 seconds in case of a copy, or ``0.8 `` seconds in case symlinks are available -
132
132
this is on Windows, Linux/macOS with symlinks this can be as low as ``100ms `` from 3+ seconds).
133
133
To override the filesystem location of the seed cache, one can use the
134
134
``VIRTUALENV_OVERRIDE_APP_DATA `` environment variable.
@@ -149,7 +149,7 @@ package. These wheels may be acquired from multiple locations as follows:
149
149
upgrading virtualenv periodically will also upgrade the version of the seed packages.
150
150
- However, end users might not be able to upgrade virtualenv at the same speed as we do new releases. Therefore, a user
151
151
might request to upgrade the list of embedded wheels by invoking virtualenv with the :option: `upgrade-embed-wheels `
152
- flag. If the operation is triggered in such manual way subsequent runs of virtualenv will always use the upgraded
152
+ flag. If the operation is triggered in such a manual way subsequent runs of virtualenv will always use the upgraded
153
153
embed wheels.
154
154
155
155
The operation can trigger automatically too, as a background process upon invocation of virtualenv, if no such upgrade
@@ -184,11 +184,11 @@ Embed wheels for distributions
184
184
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
185
186
186
Custom distributions often want to use their own set of wheel versions to distribute instead of the one virtualenv
187
- releases on PyPi. The reason for this is trying to keep the system versions of those package in sync with what
187
+ releases on PyPi. The reason for this is trying to keep the system versions of those packages in sync with what
188
188
virtualenv uses. In such cases they should patch the module `virtualenv.seed.wheels.embed
189
189
<https://github.com/pypa/virtualenv/tree/main/src/virtualenv/seed/wheels/embed> `_, making sure to provide the function
190
190
``get_embed_wheel `` (which returns the wheel to use given a distribution/python version). The ``BUNDLE_FOLDER ``,
191
- ``BUNDLE_SUPPORT `` and ``MAX `` variables are needed if they want to use virtualenvs test suite to validate.
191
+ ``BUNDLE_SUPPORT `` and ``MAX `` variables are needed if they want to use virtualenv's test suite to validate.
192
192
193
193
Furthermore, they might want to disable the periodic update by patching the
194
194
`virtualenv.seed.embed.base_embed.PERIODIC_UPDATE_ON_BY_DEFAULT
@@ -199,10 +199,10 @@ automatically, and will not alter the OS provided wheels.
199
199
200
200
Activators
201
201
----------
202
- These are activation scripts that will mangle with your shells settings to ensure that commands from within the python
203
- virtual environment take priority over your system paths. For example if invoking ``pip `` from your shell returned the
204
- system pythons pip before activation, once you do the activation this should refer to the virtual environments ``pip ``.
205
- Note, though that all we do is change priority; so if your virtual environments ``bin ``/``Scripts `` folder does not
202
+ These are activation scripts that will mangle with your shell's settings to ensure that commands from within the python
203
+ virtual environment take priority over your system paths. For example, if invoking ``pip `` from your shell returned the
204
+ system python's pip before activation, once you do the activation this should refer to the virtual environments ``pip ``.
205
+ Note, though that all we do is change priority; so, if your virtual environments ``bin ``/``Scripts `` folder does not
206
206
contain some executable, this will still resolve to the same executable it would have resolved before the activation.
207
207
208
208
For a list of shells we provide activators see :option: `activators `. The location of these is right alongside the python
@@ -214,7 +214,7 @@ command might vary by shell - e.g. bash is ``.``):
214
214
215
215
source bin/activate
216
216
217
- This is all it does; it's purely a convenience of prepending the virtual environments binary folder onto the ``PATH ``
217
+ This is all it does; it's purely a convenience of prepending the virtual environment's binary folder onto the ``PATH ``
218
218
environment variable. Note you don't have to activate a virtual environment to use it. In this case though you would
219
219
need to type out the path to the executables, rather than relying on your shell to resolve them to your virtual
220
220
environment.
@@ -230,7 +230,7 @@ also provisions a ``deactivate`` command that will allow you to undo the operati
230
230
.. note ::
231
231
232
232
If using Powershell, the ``activate `` script is subject to the
233
- `execution policies <http://technet.microsoft.com/en-us/library/dd347641.aspx >`_ on the system. By default Windows
233
+ `execution policies <http://technet.microsoft.com/en-us/library/dd347641.aspx >`_ on the system. By default, Windows
234
234
7 and later, the system's execution policy is set to ``Restricted ``, meaning no scripts like the ``activate `` script
235
235
are allowed to be executed.
236
236
0 commit comments