GeezerVison is showing github.com — Add flake8-typing-imports by kasium · Pull Request #1309 · gitpython-developers/GitPython
Conversation
The idea to include this plugin comes from #1095 . In short, flake8-typing-imports checks if a import from typing is possible in a certain python version.
I ran the plugin in your code base, and it's NOT compatible with <= 3.6.2. You use NamingTuple with defaults and NoReturn which were added in later patches of 3.6. To let in still run I set the minimum version to 3.7.0.
This means, that either we should fix the issues or gitpython needs to drop the support for this version which is anyway deprecated.
This plugin will hopefully prevent that any new issues are added
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Output for 3.6.0
git/types.py:7:1: TYP001 guard import by `if TYPE_CHECKING:`: NoReturn (not in 3.6.0, 3.6.1)
from typing import (Callable, Dict, NoReturn, Sequence, Tuple, Union, Any, Iterator, # noqa: F401
^
git/index/base.py:70:1: TYP001 guard import by `if TYPE_CHECKING:`: NoReturn (not in 3.6.0, 3.6.1)
from typing import (Any, BinaryIO, Callable, Dict, IO, Iterable, Iterator, List, NoReturn,
^
git/index/typ.py:69:5: TYP005 NamedTuple does not support defaults in 3.6.0
ctime_bytes: bytes = pack(">LL", 0, 0)
^
git/index/typ.py:70:5: TYP005 NamedTuple does not support defaults in 3.6.0
mtime_bytes: bytes = pack(">LL", 0, 0)
^
git/index/typ.py:71:5: TYP005 NamedTuple does not support defaults in 3.6.0
dev: int = 0
^
git/index/typ.py:72:5: TYP005 NamedTuple does not support defaults in 3.6.0
inode: int = 0
^
git/index/typ.py:73:5: TYP005 NamedTuple does not support defaults in 3.6.0
uid: int = 0
^
git/index/typ.py:74:5: TYP005 NamedTuple does not support defaults in 3.6.0
gid: int = 0
^
git/index/typ.py:75:5: TYP005 NamedTuple does not support defaults in 3.6.0
size: int = 0
^
git/objects/util.py:25:1: TYP001 guard import by `if TYPE_CHECKING:`: Deque (not in 3.6.0)
from typing import (Any, Callable, Deque, Iterator, NamedTuple, overload, Sequence,
^
git/refs/remote.py:12:1: TYP001 guard import by `if TYPE_CHECKING:`: NoReturn (not in 3.6.0, 3.6.1)
from typing import Any, Iterator, NoReturn, Union, TYPE_CHECKING
^
4 TYP001 guard import by `if TYPE_CHECKING:`: NoReturn (not in 3.6.0, 3.6.1)
7 TYP005 NamedTuple does not support defaults in 3.6.0
11
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Yobmod
commented
Aug 2, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I've set the checks to run :)
Seems useful already!
So we have to decide: Drop 3.6 now, or i'll pull out NamedTuple defaults (there are only a couple of uses) for now.
NoReturn and Deque are available in typing_extensions, so that can be easily fixed.
I was planning to wait until 3.10 released to drop 3.6.
But I see it had it's final release this June and i have noticed big packages already dropping it (numpy and pandas and therefore most of scientific packages).
(Copying to issue for disucssion)
|
kasium reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|