1

I'm looking for a neat way to install ipdb in tox environments, when I'm using them for development. They're often recreated, so I need something other than single installation.

Any hints?

ziima
  • 706
  • 4
  • 17
  • You can add `ipdb` to [tox requirements](https://tox.readthedocs.io/en/latest/config.html#conf-requires). – Grigory Feldman Feb 05 '20 at 09:12
  • @GrigoryFeldman That would apply to all environments, I'd like only to change the ones on my desktop. – ziima Feb 05 '20 at 09:15
  • What do you mean by "the ones on my desktop"? Do the change in your `tox.ini` file locally on your own computer but don't share this modification with other contributors, then. Are we missing some information here? – sinoroc Feb 10 '20 at 22:03
  • I don't quite want to change the `tox.ini` to prevent accidental commit. – ziima Feb 11 '20 at 16:03
  • @VlastimilZíma I understand. I don't know of any other easy solution. You could write your own plugin for _tox_ or _virtualenv_, but that would require a bit of work. On the other hand you probably could configure _git_ so that this one change is not accidentally committed locally or pushed to a remote. – sinoroc Feb 17 '20 at 13:55

1 Answers1

1

One solution would be to have your own personal customization plugin for tox that would inject ipdb as dependency in the tox environments.

Such a plugin could look like this:

tox_ipdb.py

import tox

@tox.hookimpl
def tox_configure(config):
    for envconfig in config.envconfigs.values():
        envconfig.deps.append(tox.config.DepConfig('ipdb'))

setup.py

#!/usr/bin/env python3

import setuptools

setuptools.setup(
    name='tox-ipdb',
    version='0.0.0.dev0',
    py_modules=[
        'tox_ipdb',
    ],
    entry_points={
        'tox': 'ipdb = tox_ipdb',
    },
)

This would instruct tox to install ipdb in all the environments it creates. As long as it is installed only in your local environment alongside your tox installation, it will have no influence on others.

sinoroc
  • 18,409
  • 2
  • 39
  • 70