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
* feat: support for reuse_venv option
* typing: adding Literal for reuse_venv choices
* chore: ruff-format
* chore: codespell
* chore: move `generate_noxfile_options` fixture to `conftest.py`
* chore: ruff-format
* chore: fix lints
Signed-off-by: Henry Schreiner <[email protected]>
* docs: clarify reuse_existing_venv function decision matrix
* chore: remove ``# pragma: no cover` due to recent main branch changes
* docs: call out that --reuse-existing-virtualenvs/--no-reuse-existing-virtualenvs is alias to --reuse-venv=yes|no in usage.rst
* docs: small update to config.rst
---------
Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Henry Schreiner <[email protected]>
Copy file name to clipboardExpand all lines: docs/config.rst
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,7 +157,7 @@ Use of :func:`session.install()` is deprecated without a virtualenv since it mod
157
157
deftests(session):
158
158
session.run("pip", "install", "nox")
159
159
160
-
You can also specify that the virtualenv should *always* be reused instead of recreated every time:
160
+
You can also specify that the virtualenv should *always* be reused instead of recreated every time unless ``--reuse-venv=never``:
161
161
162
162
.. code-block:: python
163
163
@@ -432,7 +432,8 @@ The following options can be specified in the Noxfile:
432
432
* ``nox.options.tags`` is equivalent to specifying :ref:`-t or --tags <opt-sessions-pythons-and-keywords>`.
433
433
* ``nox.options.default_venv_backend`` is equivalent to specifying :ref:`-db or --default-venv-backend <opt-default-venv-backend>`.
434
434
* ``nox.options.force_venv_backend`` is equivalent to specifying :ref:`-fb or --force-venv-backend <opt-force-venv-backend>`.
435
-
* ``nox.options.reuse_existing_virtualenvs`` is equivalent to specifying :ref:`--reuse-existing-virtualenvs <opt-reuse-existing-virtualenvs>`. You can force this off by specifying ``--no-reuse-existing-virtualenvs`` during invocation.
435
+
* ``nox.options.reuse_venv`` is equivalent to specifying :ref:`--reuse-venv <opt-reuse-venv>`. Preferred over using ``nox.options.reuse_existing_virtualenvs``.
436
+
* ``nox.options.reuse_existing_virtualenvs`` is equivalent to specifying :ref:`--reuse-existing-virtualenvs <opt-reuse-existing-virtualenvs>`. You can force this off by specifying ``--no-reuse-existing-virtualenvs`` during invocation. Alias of ``nox.options.reuse_venv=yes|no``.
436
437
* ``nox.options.stop_on_first_error`` is equivalent to specifying :ref:`--stop-on-first-error <opt-stop-on-first-error>`. You can force this off by specifying ``--no-stop-on-first-error`` during invocation.
437
438
* ``nox.options.error_on_missing_interpreters`` is equivalent to specifying :ref:`--error-on-missing-interpreters <opt-error-on-missing-interpreters>`. You can force this off by specifying ``--no-error-on-missing-interpreters`` during invocation.
438
439
* ``nox.options.error_on_external_run`` is equivalent to specifying :ref:`--error-on-external-run <opt-error-on-external-run>`. You can force this off by specifying ``--no-error-on-external-run`` during invocation.
Copy file name to clipboardExpand all lines: docs/usage.rst
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,34 +179,51 @@ Finally note that the ``--no-venv`` flag is a shortcut for ``--force-venv-backen
179
179
nox --no-venv
180
180
181
181
.. _opt-reuse-existing-virtualenvs:
182
+
.. _opt-reuse-venv:
182
183
183
184
Re-using virtualenvs
184
185
--------------------
185
186
186
-
By default, Nox deletes and recreates virtualenvs every time it is run. This is usually fine for most projects and continuous integration environments as `pip's caching <https://pip.pypa.io/en/stable/cli/pip_install/#caching>`_ makes re-install rather quick. However, there are some situations where it is advantageous to reuse the virtualenvs between runs. Use ``-r`` or ``--reuse-existing-virtualenvs``:
187
+
By default, Nox deletes and recreates virtualenvs every time it is run. This is
188
+
usually fine for most projects and continuous integration environments as
189
+
`pip's caching <https://pip.pypa.io/en/stable/cli/pip_install/#caching>`_ makes
190
+
re-install rather quick. However, there are some situations where it is
191
+
advantageous to reuse the virtualenvs between runs. Use ``-r`` or
192
+
``--reuse-existing-virtualenvs`` or for fine-grained control use
193
+
``--reuse-venv=yes|no|always|never``:
187
194
188
195
.. code-block:: console
189
196
190
197
nox -r
191
198
nox --reuse-existing-virtualenvs
192
-
199
+
nox --reuse-venv=yes # preferred
193
200
194
201
If the Noxfile sets ``nox.options.reuse_existing_virtualenvs``, you can override the Noxfile setting from the command line by using ``--no-reuse-existing-virtualenvs``.
202
+
Similarly you can override ``nox.options.reuse_venvs`` from the Noxfile via the command line by using ``--reuse-venv=yes|no|always|never``.
203
+
204
+
.. note::
195
205
196
-
Additionally, you can skip the re-installation of packages when a virtualenv is reused. Use ``-R`` or ``--reuse-existing-virtualenvs --no-install``:
206
+
``--reuse-existing-virtualenvs`` is a alias for ``--reuse-venv=yes`` and ``--no-reuse-existing-virtualenvs`` is an alias for ``--reuse-venv=no``.
207
+
208
+
Additionally, you can skip the re-installation of packages when a virtualenv is reused.
209
+
Use ``-R`` or ``--reuse-existing-virtualenvs --no-install`` or ``--reuse-venv=yes --no-install``:
197
210
198
211
.. code-block:: console
199
212
200
213
nox -R
201
214
nox --reuse-existing-virtualenvs --no-install
215
+
nox --reuse-venv=yes --no-install
202
216
203
217
The ``--no-install`` option causes the following session methods to return early:
0 commit comments