Skip to content
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

MAINT: Use collections.abc.Callable #2999

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

MAINT: Use collections.abc.Callable #2999

wants to merge 13 commits into from

Conversation

j-t-1
Copy link
Contributor

@j-t-1 j-t-1 commented Dec 11, 2024

typing.Callable is a deprecated alias to collections.abc.Callable.

typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.37%. Comparing base (27edc06) to head (8082c9a).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2999   +/-   ##
=======================================
  Coverage   96.36%   96.37%           
=======================================
  Files          52       52           
  Lines        8751     8766   +15     
  Branches     1593     1595    +2     
=======================================
+ Hits         8433     8448   +15     
  Misses        190      190           
  Partials      128      128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stefan6419846
Copy link
Collaborator

@j-t-1 Could you please have a look at the CI failure?

typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
typing.Callable is a deprecated alias to collections.abc.Callable.
@j-t-1
Copy link
Contributor Author

j-t-1 commented Dec 23, 2024

@stefan6419846 yes. There are a lot of deprecations from typing, and this was trying one.

This does not work, and do not know if can avoid the TYPE_CHECKING if statement:

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from collections.abc import Callable
    from typing import (
        Any,
        Dict,
        Iterator,
        List,
        Optional,
        TypeVar,
        Union,
    )

This may be a new discussion of whether if TYPE_CHECKING: is a good or bad idea. Would prefer to avoid it in this commit, was only adding it to try and pass the testing.

An option is closing this and waiting till after dropping Python 3.8, avoiding from __future__ import annotations.

@stefan6419846
Copy link
Collaborator

I have seen strange issues with some setups and testing in the past when used with TYPE_CHECKING - sometimes even with mypy. Thus, I would avoid TYPE_CHECKING here and probably ignore the corresponding ruff rule for now.

Regarding Python 3.8: How does from __future__ import annotations affect TYPE_CHECKING here? AFAIK this is about deferred evaluation of type hints.

typing.Callable is a deprecated alias to collections.abc.Callable.
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.

2 participants