Search code examples
pythonpipipythonpackaging

Optional install with pip - ipython example


The Ipython documentation mentions that there are different commands to install Ipython with pip, for example:

pip install "ipython[all]"

pip install "ipython[terminal]"

pip install "ipython[parallel]"

pip install "ipython[notebook]"

How does it work? How can I use such "options" for another package.


Solution

  • You can check setup.py in ipython-3.0.0.

    extras_require = dict(
        parallel = [pyzmq],
        qtconsole = [pyzmq, 'pygments'],
        doc = ['Sphinx>=1.1', 'numpydoc'],
        test = ['nose>=0.10.1', 'requests'],
        terminal = [],
        nbformat = ['jsonschema>=2.0'],
        notebook = ['tornado>=4.0', pyzmq, 'jinja2', 'pygments', 'mistune>=0.5'],
        nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1']
    )
    

    For instance, if you enter pip install "ipython[parallel]", pip will go to PyPi to find this package and download it.

    So if you want to apply command like this to other packages, you have to make sure there is something like this in its setup.py.