Tox: ability to define required plugins in tox.ini

Created on 5 Apr 2018  路  5Comments  路  Source: tox-dev/tox

In many cases tox needs some plugins for adding extra functionality and at this moment there is no way for the user to declare them inside the tox.ini.

Ideally tox should load a plugins = tox-pyenv, tox-pip-extensions from tox.ini and even install them if they are not already installed.

This would ease the development process as the user would not have to write bootstrapping scripts before running tox.

Current behaviour is not productive because user may run tox which would behave differently if the plugins are not installed, in many cases even passing but without intended behaviour.

new

All 5 comments

馃憤

Probably we can't just install the plugins automatically because tox might be installed in the system's Python, but in that case it should at least warn that the plugins should be installed before proceeding. Otherwise seems reasonable to pip install the plugins.

There is another side: if tox is installed along with it's plugins, in some cases they might affect the build.

I would propose:

  • do not load plugins unless explicitly declared in tox.ini
  • if they are missing, stop execution (but if there are better options such as installing the plugin into current environment - I would not complain)

Personally I would not mind if tox would attempt to install the package on current system (pip install --user or direct in case of virtualenv presence). I did this in few places over time and worked well. If it fails due to permissions at least it fails for 1/10 users and they will know what to do, much better than failing for 9/10 users.

Regardin @vlcinsky proposal, this is bit tricky and maybe we should approach a more flexible approach, as I seen on other systems using plugins (ansible, and even pytest if it remember well.)

  • nothing defined in config = keep current behaviour to load detected plugins
  • plugin_blacklist = tox-broken-plugin (or even *) -- disable any other plugins from being loaded
  • plugin[_whitelist] = tox-cool-plugin --- fail to start if this plugin is not installed or auto-installable

With something like this we should allow users to enable plugins and control them without forcing them to change tox.ini files. We need to be sure that we avoid a case where the user has to change
repository tox.ini file in order to be able run tox, just because the plugin config defined there may not apply to his system.

Examples:

  • tox-travis plugin makes sense only on travis, so adding it to mandatory list does not make sense.
  • tox-pyenv may not work on specific platform.

tox will not install packages, but will notify the user to do so, done via #936. As bonus can be used to specify general requirements of the tox run env (not just tox plugins). It has full PEP-517 support meaning you can use markers to filter for optional dependencies.

Was the ability to blacklist plugins added?

Was this page helpful?
0 / 5 - 0 ratings