@@ -39,6 +39,45 @@ syntax:
39
39
[testenv]
40
40
commands = nosetests {posargs:--with-coverage}
41
41
42
+ .. _recreate :
43
+
44
+ Dependency changes and tracking
45
+ -------------------------------
46
+
47
+ Creating virtual environments and installing dependencies is a expensive operation.
48
+ Therefore tox tries to avoid it whenever possible, meaning it will never perform this
49
+ unless it detects with absolute certainty that it needs to perform an update. A tox
50
+ environment creation is made up of:
51
+
52
+ - create the virtual environment
53
+ - install dependencies specified inside deps
54
+ - if it's a library project (has build package phase), install library dependencies
55
+ (with potential extras)
56
+
57
+ These three steps are only performed once (given they all succeeded). Subsequent calls
58
+ that don't detect changes to the traits of that step will not alter the virtual
59
+ environment in any way. When a change is detected for any of the steps, the entire
60
+ virtual environment is removed and the operation starts from scratch (this is
61
+ because it's very hard to determine what would the delta changes would be needed -
62
+ e.g. a dependency could migrate from one dependency to another, and in this case
63
+ we would need to install the new while removing the old one).
64
+
65
+ Here's what traits we track at the moment for each steps:
66
+
67
+ - virtual environment trait is tied to the python path the :conf: `basepython `
68
+ resolves too (if this config changes, the virtual environment will be recreated),
69
+ - :conf: `deps ` sections changes (meaning any string-level change for the entries, note
70
+ requirement file content changes are not tracked),
71
+ - library dependencies are tracked at :conf: `extras ` level (because there's no
72
+ Python API to enquire about the actual dependencies in a non-tool specific way,
73
+ e.g. setuptools has one way, flit something else, and poetry another).
74
+
75
+ Whenever you change traits that are not tracked we recommend you to manually trigger a
76
+ rebuild of the tox environment by passing the ``-r `` flag for the tox invocation. For
77
+ instance, for a setuptools project whenever you modify the ``install_requires `` keyword
78
+ at the next run force the recreation of the tox environment by passing the recreate cli
79
+ tox flag.
80
+
42
81
.. _`TOXENV` :
43
82
44
83
Selecting one or more environments to run tests against
0 commit comments