Optional dependency groups omitting package requirements

I often wish for this too: providing a fully-featured package by default and having a “bare” extra that removes all of the extraneous stuff for installation on a HPC cluster.

Couldn’t the existing extra environment marker serve this purpose very well if its use was allowed as such:

dependencies = [
    "heavy-package; extra != bare"
]

[project.optional-dependencies]
bare = []  # leave empty or put alternatives here
3 Likes