Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyright still reports PathLike as unknown #1620

Closed
dd-ssc opened this issue Jul 27, 2023 · 0 comments
Closed

pyright still reports PathLike as unknown #1620

dd-ssc opened this issue Jul 27, 2023 · 0 comments

Comments

@dd-ssc
Copy link

dd-ssc commented Jul 27, 2023

With sample code like

from git.repo import Repo
repo = Repo(root_of_my_repo)
print(f'repo working dir: {repo.working_tree_dir}')
print(f'is repo dirty ?: {repo.is_dirty()}')

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

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

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

However, PathLike clearly is properly defined at

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

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.

AFAICT, I use the latest versions for anything involved:

GitPython: 3.1.32
macOS:     13.4.1
Python:    3.10.12
Pylance:   v2023.7.40 (VS Code extension)
pyright:   1.1.318

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

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

Thank you very much.

@gitpython-developers gitpython-developers locked and limited conversation to collaborators Jul 28, 2023
@Byron Byron converted this issue into discussion #1622 Jul 28, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Development

No branches or pull requests

1 participant