GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add flake8-typing-imports by kasium · Pull Request #1309 · gitpython-developers/GitPython

Conversation

@kasium

@kasium kasium commented Aug 2, 2021

Copy link
Copy Markdown
Contributor

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.

All reactions
@kasium
Add flake8-typing-imports
36deddd
@kasium kasium mentioned this pull request Aug 2, 2021
Type Hints #1095
Closed
@kasium

kasium commented Aug 2, 2021

Copy link
Copy Markdown
Contributor Author

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Yobmod

Yobmod commented Aug 2, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Yobmod
Yobmod merged commit d8a6398 into gitpython-developers:main Aug 2, 2021
@kasium
kasium deleted the flake8-typing-imports branch August 2, 2021 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

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.

2 participants

@kasium @Yobmod
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.