• 12
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Optional dependencies in distutils / pip

When installing my python package, I want to be able to tell the user about various optional dependencies. Ideally I would also like to print out a message about these optional requirements and what each of them do.

I haven't seen anything yet in the docs of either pip or docutils. Do tools these support optional dependencies?

      • 2
    • I call them optional dependencies, because that is what ubuntu's package manager call them. They are not strictly required, but if they are installed, the program can use them.
    • Not a duplicate of 3664478, the other asker explicitly wanted pip-requirements which isn't a very natural way to handle this.

These are called extras, here is how to use them in your setup.py.

The base support is in pkg_resources. You need to enable distribute in your setup.py. pip will also understand them:

pip install 'package[extras]'
  • 26
Reply Report
      • 2
    • @Sean1708 No, pip doesn't have a feature like that today. One workaround is to inspect the source code's setup.py file for extras. Another is to check the "extras" key in the installed package's -.dist-info/metadata.json inside site-packages (or wherever you have the package installed).

Trending Tags