Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

MeggyCal
Copy link
Contributor

@MeggyCal MeggyCal commented Feb 7, 2025

From click 8.2.0 changelog:

Keep stdout and stderr streams independent in CliRunner. Always collect stderr output and never raise an exception. Add a new output stream to simulate what the user sees in its terminal. Removes the mix_stderr parameter in CliRunner. [:issue:`2522`](https://github.com/pallets/click/blob/main/CHANGES.rst#id27) [:pr:`2523`](https://github.com/pallets/click/blob/main/CHANGES.rst#id29)

so mix_stderr=False throws an error and is redundant.

@MeGaGiGaGon MeGaGiGaGon added the skip news Pull requests that don't need a changelog entry. label Feb 7, 2025
@MeGaGiGaGon
Copy link
Collaborator

Thanks for the contribution!
I don't understand the point/default behavior for why mix_stderr=False, but wouldn't that regress while click 8.2.0 is still unreleased?

@cobaltt7
Copy link
Collaborator

cobaltt7 commented Feb 7, 2025

Also, wouldn't this change make the entire class redundant?

@JelleZijlstra
Copy link
Collaborator

Yes, seems like we may have to make this conditional on Click version.

@MeggyCal
Copy link
Contributor Author

Ok, I will try to make it conditional 🙂

@MeggyCal
Copy link
Contributor Author

sorry, I couldn't think of a more pythonic way


def __init__(self) -> None:
super().__init__(mix_stderr=False)
if Version(imp_version('click')) >= Version('8.2.0'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if Version(imp_version('click')) >= Version('8.2.0'):
if Version(imp_version("click")) >= Version("8.2.0"):

CI is unhappy because the quotes get reformatted to double quotes, but I think it should be gtg after this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@JelleZijlstra JelleZijlstra merged commit 14e1de8 into psf:main Feb 18, 2025
43 checks passed
@MeggyCal MeggyCal deleted the click branch February 18, 2025 16:29
dsmith111 pushed a commit to jwstanly/black that referenced this pull request May 15, 2025
MeGaGiGaGon added a commit to MeGaGiGaGon/black that referenced this pull request Sep 18, 2025
Not sure on the policy for updating versions, so to cope with the new click 8.3.0 version I used some code from psf#4577 for version conditional behavior. When >= 8.3.0, unset defaults are now the special UNSET sentinal instead of None.
Hopefully nothing breaks on the click._utils usage since it's an _ module, might have to find a different solution if it does.
MeGaGiGaGon added a commit that referenced this pull request Sep 18, 2025
* Fix schema generation error caused by new click version
Not sure on the policy for updating versions, so to cope with the new click 8.3.0 version I used some code from #4577 for version conditional behavior. When >= 8.3.0, unset defaults are now the special UNSET sentinal instead of None.
Hopefully nothing breaks on the click._utils usage since it's an _ module, might have to find a different solution if it does.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add ignore for mypy error

* Actually fix mypy errors with ignore

* Add explanation for ignores

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants