8000 Work around changes in Click 8.2.0 by nolar · Pull Request #1174 · nolar/kopf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Work around changes in Click 8.2.0 #1174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2025
Merged

Work around changes in Click 8.2.0 #1174

merged 2 commits into from
May 12, 2025

Conversation

nolar
Copy link
Owner
@nolar nolar commented May 12, 2025

Click 8.2.0 has been released 2 days ago: 2025-05-10. It has introduced a few changes that are irrelevant for Kopf, but broke the CI end2end tests:

Specifically:

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.

Hence, switch from .stdout to .output in the end2end tests. The expected logs go to stderr, but they were previously visible in .stdout, so I used whatever worked.

Choice is now generic and supports any iterable value. This allows you to use enums and other non-str values.

This failed the mypy checks. The proper fix would be to remake LogFormatParamType to inhert from click.Choice[loggers.LogFormat] (the enum). But this requires the strict dependency for click>=8.2.0 for Kopf, since the type was not a generic in 8.1.x and before. However, Click 8.2.0 also drops the support for the yet-alive Python 3.9, which should be supported in Kopf till October 2025. So, I cannot make Kopf depend on click>=8.2.0 yet.

Therefore, suppress the line for the time being. Get back to that line when Python 3.9 is dropped from Kopf.

nolar added 2 commits May 12, 2025 11:38
Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
Click 8.2.0 strictly separated stdout & stderr. The logs were in stderr, but were visible in stdout, too. Now, use the proper "output" for the mixed stream when the specific stream is irrelevant (almost always).

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
@nolar nolar enabled auto-merge May 12, 2025 09:54
@nolar nolar merged commit 0c90af1 into main May 12, 2025
26 checks passed
@nolar nolar deleted the click-8.2.0 branch May 12, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0