I am using Python 3.10.4, GitPython version 3.1.31, mypy version 1.4.1:
$ pip show GitPython
Name: GitPython
Version: 3.1.31
Location: /home/hakon/.pyenv/versions/3.10.4/lib/python3.10/site-packages
Requires: gitdb
$ python --version
Python 3.10.4
$ mypy --version
mypy 1.4.1 (compiled: yes)
If run mypy on this minimal example (git-python-types.py) :
import git
repo = git.Repo('some_dir')
I get the following error:
$ mypy --strict git-python-types.py
git-python-types.py:3: error: Module "git" does not explicitly export attribute "Repo" [attr-defined]
Found 1 error in 1 file (checked 1 source file)
Any ideas on why this error occurs and how to fix it?
Some clues
I can see the following line in the GitPython source code :
from git.repo import Repo # @NoMove @IgnorePep8
but I am not sure if mypy is reading this line or not.
python git-python-types.py)--strict, false positives do occur.