If this checks whether an extra is logically installed (i.e. are its dependencies all satisfied), it needs to go into packaging
because that’s needed to parse dependency information. This is why I’m interested in the “record the extra user explicitly requested” idea; that information can be reliably populated on install time and don’t need packaging
to parse, and can therefore go into importlib.metadata
.
Perhaps it would be a good idea to have discrete functions for these two things so a package can freely choose which approach works better for the use case. If you’re fine telling users they need to explicitly specify foo[extra]
for things to work, you can use the stricter is_extra_requested
from importlib.metadata
; if you want to be permissive and allow a user to populate the extra via other means, you can pull in is_extra_satisfied
from packaging
and do it that way.