Skip to content

Support click v8.4#1260

Merged
sirosen merged 7 commits into
globus:mainfrom
sirosen:support-click-8.4
May 27, 2026
Merged

Support click v8.4#1260
sirosen merged 7 commits into
globus:mainfrom
sirosen:support-click-8.4

Conversation

@sirosen
Copy link
Copy Markdown
Member

@sirosen sirosen commented May 21, 2026

8.4 introduces relatively few changes, but does make ParamType a
Generic parametrized over the return type of convert(). Unfortunately,
we also support Python 3.9 , which means we must support older click
versions. As such, ParamType is not even subscriptable on that version.

To work around this, we use TYPE_CHECKING guards to split definitions
between a generic and non-generic variant.

Only one line of runtime code is changed:
A superfluous call to super().convert() was flagged by mypy for
having the wrong type and is here removed.

@sirosen sirosen added the no-news-is-good-news This change does not require a news file label May 21, 2026
8.4 introduces relatively few changes, but does make `ParamType` a
Generic parametrized over the return type of `convert()`. Unfortunately,
we also support Python 3.9 , which means we must support older click
versions. As such, `ParamType` is not even subscriptable on that version.

To work around this, we use `TYPE_CHECKING` guards to split definitions
between a generic and non-generic variant.

Only one line of runtime code is changed:
A superfluous call to `super().convert()` was flagged by `mypy` for
having the wrong type and is here removed.
@sirosen sirosen force-pushed the support-click-8.4 branch from b8358f5 to c236c88 Compare May 27, 2026 16:42
Copy link
Copy Markdown
Member

@kurtmckee kurtmckee left a comment

Choose a reason for hiding this comment

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

It looks like click is continuing to release breaking changes in minor releases. We're on a treadmill.

I recommend that instead of "supporting click v8.4" this PR change to "require click v8.4". This is an application, and I think we can treat its dependencies as such by pinning them.

We already do this for a number of dependencies; I don't see a reason why click should be an outlier that requires a range of supported versions.

Comment thread src/globus_cli/commands/gcp/set_subscription_id.py Outdated
Comment thread src/globus_cli/commands/api.py
Comment thread src/globus_cli/parsing/param_types/endpoint_plus_path.py Outdated
Comment thread src/globus_cli/parsing/param_types/notify_param.py Outdated
Comment thread pyproject.toml Outdated
@sirosen
Copy link
Copy Markdown
Member Author

sirosen commented May 27, 2026

We discussed offline, but to surface in the permanent record:

click does not use semver. So it is expected and normal for minor releases to be breaking.
I would say there is no process problem here. On reflection, I may add a comment to our dependency spec about this.

We weren't able to drop old click versions when we picked up 8.3 support because click had dropped Python 3.9 and at the time we were not prepared to do so. Now that that has been freed up, we can update our lower bound and only support >= 8.4 , < 8.5.

sirosen added 6 commits May 27, 2026 15:11
Now that we have removed support for click 8.3 and lower, `ParamType` is
always generic and can have its type parameter specified directly.

In one very specific case -- omittable datetimes -- this is specially
handled with an explanatory comment.
This module is no longer needed now that our minimum version of click is
8.4 . Remove it and update all usages (which were structured to make this
removal simple).
Searching for other `click`-version-sensitive code, outside of what is
handled by `_click_compat`, we find one usage site, updated here.
Part of the documented signature of `convert()` is that `None` will never
be passed to it. In spite of this, several `convert()` definitions in the
CLI had inherited this handling from very old versions of `click`.
Update to match current style.

(NB: callbacks can still receive a `None`, which is used for various
parameter definitions.)
`__call__` takes `str | None` and returns `UUID | None`.
`convert()` takes `str` and returns `UUID`.

Switching to use `convert()` has a positive effect.
@sirosen
Copy link
Copy Markdown
Member Author

sirosen commented May 27, 2026

I've done a full pass here, in independently reviewable commits. One side-effect of removing older click versions is that _click_compat and its usages are all gone.

@sirosen sirosen merged commit 8d75cd8 into globus:main May 27, 2026
6 checks passed
@sirosen sirosen deleted the support-click-8.4 branch May 27, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-news-is-good-news This change does not require a news file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants