Skip to content

Commit beda06a

Browse files
committed
Document tox provisioning
Fixes #39
1 parent e7456d9 commit beda06a

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

README.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,44 @@ use the ``TOX_TESTENV_PASSENV`` environment variable.
207207
Read `the documentation for passing environment variables to tox
208208
<https://tox.readthedocs.io/en/latest/config.html#conf-passenv>`_.
209209

210+
Tox provisioning
211+
~~~~~~~~~~~~~~~~
212+
213+
The tested projects can specify the
214+
`minimal tox version <https://tox.readthedocs.io/en/latest/config.html#conf-minversion>`_
215+
and/or
216+
`additional requires <https://tox.readthedocs.io/en/latest/config.html#conf-requires>`_
217+
needed in the environment where ``tox`` is installed.
218+
Normally, ``tox`` uses *provisioning* when such requirements are not met.
219+
It creates a virtual environment,
220+
installs (a newer version of) ``tox`` and the missing packages
221+
into that environment and proxies all ``tox`` invocations trough that.
222+
Unfortunately, this is undesired for ``tox-current-env``.
223+
224+
1. Starting with ``tox`` 3.23, it is possible to invoke it as
225+
``tox --no-provision`` to prevent the provision entirely.
226+
When requirements are missing, ``tox`` fails instead of provisioning.
227+
If a path is passed as a value for ``--no-provision``,
228+
the requirements will be serialized to the file, as JSON.
229+
2. Starting with ``tox`` 3.22, the requires, if specified, are included in the
230+
results of ``tox --print-deps-to``.
231+
This only works when they are installed (otherwise see the first point).
232+
3. The minimal tox version, if specified, is included in the results of
233+
``tox --print-deps-to`` (as ``tox >= X.Y.Z``).
234+
This only works when the version requirement is satisfied
235+
(otherwise see the first point).
236+
237+
With ``tox >= 3.23``, the recommend way to handle this is:
238+
239+
1. Run ``tox --no-provision provision.json --print-deps-to=...`` or similar.
240+
2. If the command fails, install requirements from ``provision.json`` to the
241+
current environment and try again.
242+
243+
Note that the specified requirements are likely to contain
244+
`other tox plugins <https://tox.readthedocs.io/en/latest/plugins.html>`_
245+
and many of them might interfere with ``tox-current-env`` in an undesired way.
246+
If that is the case, the recommended way is to patch/sed such undesired plugins
247+
out of the configuration before running ``tox``.
210248

211249
Other limitations and known bugs
212250
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)