Reinstall virtualenv with tox when requirements.txt or setup.py changes

后端 未结 3 1520
北荒
北荒 2021-01-02 00:21

Previously I was manually using a Makefile that looked something like this:

.PHONY: all
all: tests

.PHONY: tests
tests: py_env
    bash -c \'source py_env/b         


        
3条回答
  •  伪装坚强ぢ
    2021-01-02 01:07

    Determined to solve this, I've written a tox plugin to accomplish this: https://github.com/asottile/tox-pip-extensions

    The plugin hooks into virtualenv creation and uses venv-update to keep dependencies in sync.

    The usage is pretty straightforward:

    • install tox-pip-extensions alongside tox (in my setup, I have a virtualenv at ~/venv with tox and tox-pip-extensions installed, and then symlinked ~/venv/bin/tox -> ~/bin/tox)
    • enable the extension as follows:

      [tox]
      tox_pip_extensions_ext_venv_update = true
      # the rest of your tox.ini file as normal...
      

提交回复
热议问题