Environment is not recreated when install_requires in setup.py is changed
pytoxbot opened this issue · 15 comments
- Bitbucket: https://bitbucket.org/hpk42/tox/issue/93
- Originally reported by: @tkf
- Originally created at: 2013-04-15T22:07:44.806
Here is a recipe to reproduce this problem.
- Run tox in some project.
- Add a new package to install_requires in setup.py
- Run tox again.
I can write dependency in tox.ini to force recreate, but I think it is simpler if tox reinstall package. I think it is as easy as removing --no-deps flag so I wonder why --no-deps is used in the first place. Is there any drawbacks? Wouldn't it be nice if we can disable this flag optionally?
Original comment by @graingert
pull request #64 should help with this:
simply configure your setup.py to pull install_requires
out of requirements.txt, and set the deps to -r{toxinidir}requirements.txt
Original comment by @graingert
You also get the same problem if -r{toxinidir}requirements.txt
is used
Original comment by @graingert
Might be an idea to use https://pypi.python.org/pypi/pip-accel
Original comment by @hpk42
Maybe we could do a "setup.py egg_info" if "setuptools"
appears in setup.py
and then fish for *.egg-info/requirements.txt to get to know the deps. This would still allow changing other aspects of setup.py without recreating automatically the venv.
Original comment by @lukaszb
I would vote against it.
Passing --recreate
flag seems good enough. I often tinker setup.py
file without touching deps at all and if I do, I actually know about it most of the time.
Original comment by @hpk42
we could probably do a checksum of the setup.py and run a full (no --no-deps
) install if it changes. There is no direct general way to just get the install_requires
content out of it.
Original comment by @tkf
Can't we detect requirements before running pip? Or how about caching setup.py (or compare timestamp or checksum) and reinstall it without --no-deps when it is changed?
Original comment by @hpk42
Some time ago someone else complained that reinstalling a package would always re-install the dependencies, increasing overall run time. Changing install_requires is a relatively rare event -- can you not issue --recreate on this occassion?
Original comment by @tkf
I guess a simple solution is to put the following in the first entry of commands
pip install --quiet --use-mirrors {toxinidir} --log {envtmpdir}/pip.log
Reading through this my impression is that the existing functionality is already enough and the opinions differ if and how this should be solved.
I would tend to close this as wontfix soonish - any objections?
Actually it's not too hard to inspect the requirements of a package via setuptools
@graingert actually its nondetermistic and broken to try and do so with just setuptools ^^
the amount of logic, sandboxing &more pip adds around to keep things sane is hard to copy
@obestwalter I just ran into this issue recently, and it strikes me as very unexpected behavior.
When I run tox, I expect all my changes - documentation, code, etc - to be incorporated in the environments managed by tox. I tend to think of setup.py as just another python file in the project.
At the very least, the documentation needs to explicitly mention this behavior. Ideally python setup.py --requires
would also print out the install_requires
input, but it prints out packages fed into requires
instead (is requires
even used anymore?).
At the very least, the documentation needs to explicitly mention this behavior.
I agree, that is the least we can do.