Skip to content

Conversation

@MeGaGiGaGon
Copy link
Collaborator

Description

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.

Checklist - did you ...

  • [N/A] Implement any code style changes under the --preview style, following the
    stability policy?
  • [N/A] Add an entry in CHANGES.md if necessary?
  • [N/A] Add / update tests if necessary?
  • [N/A] Add new / update outdated documentation?

MeGaGiGaGon and others added 2 commits September 18, 2025 12:32
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.
@cobaltt7 cobaltt7 added the skip news Pull requests that don't need a changelog entry. label Sep 18, 2025
@MeGaGiGaGon
Copy link
Collaborator Author

Looks like this does have mypy issues despite working to fix the issue

result[name]["description"] = param.help

if param.default is not None and not param.multiple:
if Version(imp_version("click")) >= Version("8.3.0"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could also do something like hasattr(click, "_utils") and hasattr(click._utils, "UNSET"), though I guess it will still need a mypy type ignore. The current code is fine with me too.

Normally I'd be concerned about breaking future users if click removes or moves the private object later, but this is just an internal script; if it breaks later we can just fix it and users won't be affected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I searched around for a while but I don't see a better way of doing it that doesn't involve a mypy ignore, so 🤷.
I like the current code since it says that whatever the problem/change is, it starts in click 8.3.0.

@MeGaGiGaGon MeGaGiGaGon merged commit ffc01a0 into psf:main Sep 18, 2025
42 of 43 checks passed
@MeGaGiGaGon MeGaGiGaGon deleted the fix-click-update-schema-error branch September 18, 2025 21:33
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.

3 participants