pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Support for default groups

Open patrick91 opened this issue 1 year ago • 2 comments

Hi there!

I have a project that has an option command line interface, which can be installed via pip install lib[cli]

This is not a big deal, but I was wondering if pipx could support a default group for when running/installing a library, so users would only need to run pipx run lib (or pipx install lib)

This would remove some friction in using the cli from my library, and also prevent some small issue like quoting (some shells don't like the [] syntax 😊)

Maybe pipx could check if there's a cli group, or maybe we can add some metadata on the package?

Not sure if all of these are feasible 😊

Another option on myside would be to check if the dependencies are missing and tell the user to run install/run lib[cli], but I'd like to avoid one extra step if possibile 😊

patrick91 avatar Apr 03 '24 09:04 patrick91

This is not a big deal, but I was wondering if pipx could support a default group for when running/installing a library, so users would only need to run pipx run lib (or pipx install lib)

Hmm, you mean whenever installing a library, a cli extra should be installed? AFAIK, there is no such standard that a library should expose its CLI interface via an extra called that way? I do think the behaviour that we have right now is correct, and if I understand you correctly, the only way to detect an entry point within a library would be searching amongst its extras, which I think is a bit overshooting.

chrysle avatar Apr 03 '24 16:04 chrysle

@chrysle just to clarify, I don't think pipx is doing anything wrong, I was just thinking if there's a way to make the experience better in some cases 😊

This was inspired by a conversation I had with @dbanty, as we were chatting about default dependencies (inspired by cargo: https://doc.rust-lang.org/cargo/reference/features.html)

the only way to detect an entry point within a library would be searching amongst its extras, which I think is a bit overshooting.

Yeah probably, I wonder if there's something we can add in the package metadata for that? Also maybe it could be better to use a pipx group, so there are less potential issues?

Also, I'm totally fine with closing this issue if you don't think is a good addition :D

patrick91 avatar Apr 04 '24 08:04 patrick91