Skip to content

Conversation

edrogers
Copy link
Contributor

Fixes #1531

This PR uses typing.override in favor of the overrides dependency when possible. As of Python 3.12, the standard library offers typing.override to perform a static check on overridden methods.

Motivation

Currently, overrides is incompatible with Python 3.14. As a result, any package that attempts to import overrides using Python 3.14+ will raise an AttributeError. An issue has been raised and a pull request has been submitted to the GitHub repo for the overrides project. But the maintainer has been unresponsive.

To ensure readiness for Python 3.14, this package (and any other package directly depending on overrides) should consider using typing.override instead.

Impact

The standard library added typing.override as of 3.12. As a result, this change will affect only users of Python 3.12+. Previous versions will continue to rely on overrides. Notably, the standard library implementation is slightly different than that of overrides. A thorough discussion of those differences is shown in PEP 698, and it is also summarized nicely by the maintainer of overrides here. The upshot is that typing.override does not implement any runtime checking. Instead, it provides information to type checkers.

An Alternative Approach

We could imagine preferring the overrides package when it's available and imports successfully. That implementation might look like this:

try:
    from overrides import overrides
except AttributeError as e:
    if ("module 'typing' has no attribute 'ByteString'" in str(e)):
        # Fallback option (only for Python 3.12+)
        from typing import override as overrides

While I originally considered this approach, a dive into why overrides was brought in as a dependency turned up this conversation between @Zsailer and @kevin-bates. In it, @Zsailer refers to the overrides library as a "temporary" dependency. The PR as I've written it here makes a silent switch over to using the standard library approach going forward.

@krassowski krassowski added the bug label Jun 26, 2025
@jasongrout jasongrout requested a review from vidartf July 24, 2025 15:52
Copy link
Contributor

@bollwyvl bollwyvl left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

Copy link
Collaborator

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Would be great to have that in to allow testing with Python 3.14

@vidartf vidartf merged commit 5558318 into jupyter-server:main Aug 6, 2025
62 of 64 checks passed
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Aug 25, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Aug 31, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Sep 6, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Sep 13, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Sep 20, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Sep 27, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Ponce pushed a commit to Ponce/slackbuilds that referenced this pull request Oct 4, 2025
It's not needed anymnore for python >= 3.12
jupyter-server/jupyter_server#1532

Signed-off-by: Matteo Bernardini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dependency on overrides causes crash for Python 3.14
4 participants