DurandA
DurandA

Reputation: 1569

How to package a Python module with extras as default?

My Python package has optional features (extras_require) and I would prefer them to be selected by default.

More specifically, I'd like that pip install mypackage behaves like pip install mypackage[extra] and that I can install a minimal version with something like pip install mypackage[core].

setup(
    name="mypackage",
    ...
    extras_require={
        "extra":  ["extra1>=1.2", "extra2"],
        "core": [],
    }
)

Is it possible to achieve this with a setup script similar to above?

Upvotes: 11

Views: 3594

Answers (1)

Dustin Ingram
Dustin Ingram

Reputation: 21580

Unfortunately this is not possible with the current state of Python packaging metadata & tooling.

See a long discussion here as to why.

Upvotes: 7

Related Questions