Skip to content

refactor[eve]: drop support for custom typehints like Dict #2120

@romanc

Description

@romanc

Description

Currently, eve/extended_typings re-exposes dict as Dict and other similar type classes.

if _sys.version_info >= (3, 9):
# Standard library already supports PEP 585 (Type Hinting Generics In Standard Collections)
from builtins import ( # type: ignore[assignment]
dict as Dict,
frozenset as FrozenSet,
list as List,
set as Set,
tuple as Tuple,
type as Type,
)
from collections import (
ChainMap as ChainMap,
Counter as Counter,
OrderedDict as OrderedDict,
defaultdict as defaultdict,
deque as deque,
)
from collections.abc import (
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
ByteString as ByteString,
Callable as Callable,
Collection as Collection,
Container as Container,
Coroutine as Coroutine,
Generator as Generator,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
Mapping as Mapping,
MappingView as MappingView,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Reversible as Reversible,
Sequence as Sequence,
Set as AbstractSet,
ValuesView as ValuesView,
)
from contextlib import (
AbstractAsyncContextManager as AsyncContextManager,
AbstractContextManager as ContextManager,
)
from re import Match as Match, Pattern as Pattern

While this was useful for earlier python versions, since python 3.10 type classes like dict are also generics and there's no need for Dict and friends anymore. We'd like to clean this up and use dict (and friends) over Dict (and friends), removing the re-export from eve/typings_extended.

This is a follow-up from discussion in PR #2093 (review).

/cc @egparedes as discussed, let's make this an issue rather than a TODO note in code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions