Extra packages in setuptools

  python, setup.py, setuptools

I created a package which has 2 modes:

  • the basic mode with basic functionality only
  • extended functionality which adds additional modules and needs extra requirements.

For example:

  • MyPackageName
    • core
    • cyber_analyzer
    • parsing

Where "parsing" is the extension and needs "pandas" as requirement.

Then, I want my package to have 2 modes:

  • pip install mypackage
  • pip install mypackage[parsing]

I found out I can use extras_require to install "pandas". Yet, installing the whl file would install all the 3 modules: core, cyber_analyzer and parsing. I would like to install "parsing" only if the extra flag "parsing" was specified.

Is it possible to do so? How can I achieve it? Should I always install "parsing" and the users shouldn’t use it?

Source: Python Questions

LEAVE A COMMENT