You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEP 585 makes a lot of built-in types in the Python standard library generic as of Python 3.9. This deprecates a lot of imports from the typing module, since we don't need to import those types anymore to use generic types.
For example, this code was typed using the typing module:
Add import-linter rules that forbid importing from the deprecated typing modules listed in PEP 585. Those are in the implementation section following the # symbols.
More details (click to expand)
For example, the tool should forbid imports like from typing import List and recommend that list just be used as a type directly.
Here's an image that refers to what I wrote above. Note how the recommended new type is shown first, and then the deprecated typing module follows the # symbol on each line.
Run import-linter locally, fix all the imports, then open a PR for the main branch.
Do the same for the 2.x branch. Normally the bot can be used to backport changes (@meeseeksdev please backport to 2.x), but there will likely be too many merge conflicts. I recommend just creating a separate branch and re-doing the steps here.
Context
From the PEP:
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.
The text was updated successfully, but these errors were encountered:
The PR should also include a full list of all deprecated typing modules & their replacements. That will allow reviewers to verify this against PEP 585.
Description
PEP 585 makes a lot of built-in types in the Python standard library generic as of Python 3.9. This deprecates a lot of imports from the
typing
module, since we don't need to import those types anymore to use generic types.For example, this code was typed using the
typing
module:However, this is no longer necessary, since the built-in
list
type can be used as a generic type annotation now:Proposed solution
Add
import-linter
back to the CI workflows. This was removed in a previous PR, but here's the original one that added it: https://github.com/jupyterlab/jupyter-ai/pull/546/filesAdd
import-linter
rules that forbid importing from the deprecatedtyping
modules listed in PEP 585. Those are in the implementation section following the#
symbols.More details (click to expand)
For example, the tool should forbid imports like
from typing import List
and recommend thatlist
just be used as a type directly.Here's an image that refers to what I wrote above. Note how the recommended new type is shown first, and then the deprecated
typing
module follows the#
symbol on each line.Run
import-linter
locally, fix all the imports, then open a PR for themain
branch.Do the same for the
2.x
branch. Normally the bot can be used to backport changes (@meeseeksdev please backport to 2.x
), but there will likely be too many merge conflicts. I recommend just creating a separate branch and re-doing the steps here.Context
From the PEP:
The text was updated successfully, but these errors were encountered: