Skip to content
\n

I see VS Code / pylance / pyright messages like these (shortened for better readability):

\n
Type of \"working_tree_dir\" is partially unknown\n  Type of \"working_tree_dir\" is \"Unknown | None\"\n
\n
Type of \"is_dirty\" is partially unknown\n  Type of \"is_dirty\" is \"(index: bool = True, ..., path: Unknown | None = None) -> bool\"\n
\n

both of which seem to be caused by the type of PathLike to be unknown.

\n

However, PathLike clearly is properly defined at

\n
\n

\n GitPython/git/types.py\n

\n

\n Line 46\n in\n 1c8310d\n

\n
\n
\n \n\n \n \n \n \n
PathLike = Union[str, os.PathLike[str]]
\n
\n
\n.

\n

Also, in general, I see from #1095 that full type support has been added to GitPython two years ago - and some detail of this very PathLike issue seems to have been addressed in #1473 about 13 months ago.

\n

AFAICT, I use the latest versions for anything involved:

\n
GitPython: 3.1.32\nmacOS:     13.4.1\nPython:    3.10.12\nPylance:   v2023.7.40 (VS Code extension)\npyright:   1.1.318\n
\n

Why am I still seeing these pyright issues ?
\nDo I need to do anything special to get GitPython type support ?
\nCould there anything wrong with my setup ?
\n(Using the same setup (e.g. pyright conf) as in 10+ similar projects with no problems, but you never know...)

\n

Really puzzled here and would be really grateful for any advice.

\n

Thank you very much.

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Since your setup works fine for 10+ similar projects, I'd assume that those simply are better maintained. As a matter of fact, I have no development setup for Python at all and cannot run any tests locally anymore.
\nAs for contributors, I don't know how they do it but would assume they have similar issues that they ignore.

\n

After the typing extensions were contributed, they are essentially unmaintained, but receive some improvements from time to time from folks who experience issues with them.

\n

Thus you are welcome to fix it for your setup and submit a PR - I have no idea how that should work though.

","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1622#discussioncomment-6573462"}}}

pyright still reports PathLike as unknown #1622

Answered by Byron
dd-ssc asked this question in Q&A
Discussion options

You must be logged in to vote

Since your setup works fine for 10+ similar projects, I'd assume that those simply are better maintained. As a matter of fact, I have no development setup for Python at all and cannot run any tests locally anymore.
As for contributors, I don't know how they do it but would assume they have similar issues that they ignore.

After the typing extensions were contributed, they are essentially unmaintained, but receive some improvements from time to time from folks who experience issues with them.

Thus you are welcome to fix it for your setup and submit a PR - I have no idea how that should work though.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1620 on July 28, 2023 08:08.