Skip to content

Replace deprecated typing aliases by their official collections.abc and builtin classes #718

@joanise

Description

@joanise

Bug description

The following typing aliases have been deprecated since Python 3.9.

We should replace them by their current recommended equivalents, which all support subscripting since Python 3.9:

  • list
  • dict
  • collections.abc.Callable
  • collections.abc.Sequence
  • etc.

While it's still safe to use either variant for the moment, PEP 585 says:

The deprecated functionality may eventually be removed from the typing module. Removal will occur no sooner than Python 3.9’s end of life, scheduled for October 2025.

October 2025 is coming soon so it would be good to adapt sooner than later if we want to be compatible with future versions of Python.

For wav2vec2aligner, where we declare support for Python 3.8, we could use from __future__ import annotations to enable subscripting list[...] and dict[...].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions