Search code examples
pythontoxipdb

Install ipdb to tox environment for development


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?


Solution

  • 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.