mitsuhiko / pipsi

pip script installer
Other
2k stars 133 forks source link

Cannot easily run from a script due to error handling #95

Open kjwilcox opened 7 years ago

kjwilcox commented 7 years ago

I am using pipsi via an ansible script to install several packages. Because I don't necessarily know ahead of time what version (if any) of the packages are already there, I am running into issues with error detection and error handling.

pipsi install will exit with a 1 status code if there is an installation error or the package is already installed. I can't figure out a good way to distinguish these automatically (trying to scrape stderr/stdout seems really fragile).

pipsi upgrade will exit with a 1 status code if the package is not installed, or if it is already up-to-date.

In 99% of cases, I just don't care what the current state of the world is and want to end up with the latest version of the package installed.


I'd really like to be able to run a single pipsi command and have it:

That might look like pipsi install mypackage --upgrade. Another option might be to change exit statuses (although that seems like a breaking change).

I'd be happy to submit a pull request for this if it's something you'd like to see added to pipsi.

pjz commented 7 years ago

I'm working on using pipsi to avoid dependency conflicts in production deploys of internal python projects, so need this same functionality. The return-value thing is severly hampering attempts to use it in an ansible script.

pjz commented 7 years ago

Proposed:

pipsi install returns:

I agree that there should be an install-or-upgrade-as-appropriate kind of command, though if we follow pips example, there would be a --upgrade flag to pipsi install that would do it. Alternately perhaps a --force or --installflag to pipsi upgrade would cause an install instead of failure if the package wasn't present. Another alternative would be to introduce a third command, perhaps something like pipsi latest <package>.

I'm neutral on which choice to make, just trying to lay out the options in hope of getting something done.

RonnyPfannschmidt commented 7 years ago

i like the proposal

tiborsimon commented 5 years ago

Just run into the same issue. Any updates on this proposal?

cs01 commented 5 years ago

pipsi is effectively abandoned. For a project that is actively maintained and picks up where pipsi left off, check out https://github.com/pipxproject/pipx-app.