1. Holger Krekel
  2. tox
  3. Issues


Issue #149 on hold

virtualenv is not recreated when deps change if '-r' is used

Gavrie Philipson
created an issue

In my tox.ini, I have the following deps:

deps = -rpackaging/requirements.txt

Normally, when deps change, the virtualenv is recreated by tox. However, when the contents of requirements.txt change, tox does not notice this and the environment is reused.

A workaround would be to list the deps directly in tox.ini, but that would require duplicating the contents of the existing requirements.txt that is used by other tools.

Comments (12)

  1. Antoine Musso

    A way to reproduce:

    $ cat tox.ini
    skipsdist = True
    deps = -rrequirements.txt
    $ echo -n > requirements.txt
    $ tox
    $ cat .tox/venv/.tox-config1 
    00000000000000000000000000000000 /usr/local/opt/python/bin/python2.7
    1.8.1 0 0 0
    00000000000000000000000000000000 -rrequirements.txt

    Then add a new requirement and rerun tox:

    $ echo pep8 > requirements.txt
    $ tox -vvv
    $ tox -vvv
      removing /private/tmp/toxdeps/.tox/log
    using tox.ini: /private/tmp/toxdeps/tox.ini
    using tox-1.8.1 from /usr/local/lib/python2.7/site-packages/tox/__init__.pyc
    skipping sdist step
    venv start: getenv /private/tmp/toxdeps/.tox/Venn
    venv reusing: /private/tmp/toxdeps/.tox/venv
    venv finish: getenv after 0.02 seconds
    venv start: finishvenv 
    venv finish: finishvenv after 0.00 seconds

    .tox-config1 remains identical.

    VirtualEnv._getresolvedeps() should be made to understand the '-rsomefile.txt' and parse its content, or even better delegate the dependencies resolution to pip itself. pip.req.parse_requirements() has all the logic :-}

  2. Mark Hirota

    What about recognizing the special case of deps = -r<something> and calculating the md5 based on the file contents? This would trigger recreate if anything in the requirements.txt changed... but I think that might be better than duplicating what is in pip or introducing a hard dependency on pip in tox.

  3. Buck Evan

    That's only slightly better. Requirement files can and do contain '-r more.txt' lines to pull in further requirements.

    To the dependency concern: tox already has a hard dependency on virtualenv, which contains a vendored copy of pip. We can make use of this if necessary.

    --phone is hard.

  4. Holger Krekel repo owner

    If somebody can submit a PR helping with working better with "-r" lines, please do. Note that i just released tox-1.9.1 which contains some code in relation to "--force-deps" which parses requirements.

  5. Holger Krekel repo owner

    Within tox-1.9.1 (superseded quickly by 1.9.2) we had some code that parsed requirement files but it was buggy and caused problems.

    I am all for adding proper support for dealing with requirement files in deps.

    I think that tox will need to support pip==1.5.6 at least if not older versions.

  6. Log in to comment