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
Copy file name to clipboardexpand all lines: docs/example/basic.rst
+15-6
Original file line number
Diff line number
Diff line change
@@ -121,26 +121,35 @@ Depending on requirements.txt or defining constraints
121
121
122
122
.. versionadded:: 1.6.1
123
123
124
-
(experimental) If you have a ``requirements.txt`` file or a ``constraints.txt`` file you can add it to your ``deps`` variable like this:
124
+
(experimental) If you have a ``requirements.txt`` file you can add it to your ``deps`` variable like this:
125
125
126
126
.. code-block:: ini
127
127
128
128
[testenv]
129
129
deps = -rrequirements.txt
130
130
131
-
or
131
+
This is actually a side effect that all elements of the dependency list is directly passed to ``pip``.
132
+
133
+
If you have a ``constraints.txt`` file you could add it to your ``deps`` like the ``requirements.txt`` file above.
134
+
However, then it would not be applied to
135
+
136
+
* build time dependencies when using isolated builds (https://github.com/pypa/pip/issues/8439)
137
+
* run time dependencies not already listed in ``deps``.
138
+
139
+
A better method may be to use ``setenv`` like this:
132
140
133
141
.. code-block:: ini
134
142
135
143
[testenv]
136
-
deps =
137
-
-rrequirements.txt
138
-
-cconstraints.txt
144
+
setenv = PIP_CONSTRAINT=constraints.txt
145
+
146
+
Make sure that all dependencies, including transient dependencies, are listed in your ``constraints.txt`` file or the version used may vary.
147
+
148
+
It should be noted that ``pip``, ``setuptools`` and ``wheel`` are often not part of the dependency tree and will be left at whatever version ``virtualenv`` used to seed the environment.
139
149
140
150
All installation commands are executed using ``{toxinidir}`` (the directory where ``tox.ini`` resides) as the current working directory.
141
151
Therefore, the underlying ``pip`` installation will assume ``requirements.txt`` or ``constraints.txt`` to exist at ``{toxinidir}/requirements.txt`` or ``{toxinidir}/constraints.txt``.
142
152
143
-
This is actually a side effect that all elements of the dependency list is directly passed to ``pip``.
144
153
145
154
For more details on ``requirements.txt`` files or ``constraints.txt`` files please see:
0 commit comments