Skip to content

Add --exit-code to make install --dry-run return non-zero when packages would be installed#13803

Closed
flying-sausages wants to merge 4 commits intopypa:mainfrom
flying-sausages:dry-run-exit-error-if-would
Closed

Add --exit-code to make install --dry-run return non-zero when packages would be installed#13803
flying-sausages wants to merge 4 commits intopypa:mainfrom
flying-sausages:dry-run-exit-error-if-would

Conversation

@flying-sausages
Copy link

@flying-sausages flying-sausages commented Feb 12, 2026

Fixes #13802

  • Changes the return code in case the dry-run indicates that some changes would be made

@flying-sausages
Copy link
Author

Should this get some tests?

@notatallshaw
Copy link
Member

Sorry, I misread your request, I was thinking you were asking for when dry run fails.

If it succeeds but would install something I don't think that should be non-zero.

But I do agree it would be good to programmatically tell the difference, I think it might be possible by using an installation report, I will try and look later today after work.

@flying-sausages
Copy link
Author

The amount of tests failing suggest that there's a precedent with the expectation that this will continue working as is.

I still do think there's value in having a non-zero return for a dry-run which reports changes, would it be an option to add an extra flag such as --exit-code to enable this behaviour, and change the exit code to either 65 or 79 so it can be distinguished from an actual error? This would keep the existing interface working as is, and make it

@flying-sausages flying-sausages changed the title Make install --dry-run return ERROR if requirements not satisfied Add --exit-code to make install --dry-run return non-zero when packages would be installed Feb 12, 2026
@flying-sausages flying-sausages force-pushed the dry-run-exit-error-if-would branch from f6574dd to 9667c03 Compare February 12, 2026 22:30
@notatallshaw
Copy link
Member

notatallshaw commented Feb 13, 2026

Unfortunately I don't think this use case warrants yet another flag, and like our tests users might be dependent on our exit codes.

If we did decide this required special exit code behavior I would rather go through a deprecation cycle where we warn users that we are going to change the behavior. And I don't think this use case warrants that either.

In the mean time see my example of implementing this programmatically with existing tools: #13802 (comment). In fact, I might switch our tests to use this.

@flying-sausages
Copy link
Author

Hmm I see. Makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change exit code for an unsatisfied dry-run install

2 participants

Comments