PyMySQL/mysqlclient

2.2.0: mypy errors

mtelka opened this issue · 1 comments

Describe the bug

mypy 1.4.1 reports following errors for mysqlclient 2.2.0:

_________________________________ configdb.py __________________________________
21: error: Library stubs not installed for "MySQLdb"  [import]
21: note: Hint: "python3 -m pip install types-mysqlclient"
21: note: (or run "mypy --install-types" to install all missing stub packages)
21: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_______________________________ capabilities.py ________________________________
16: error: Need type annotation for "connect_kwargs" (hint: "connect_kwargs: Dict[<type>, <type>] = ...")  [var-annotated]
19: error: Incompatible types in assignment (expression has type "bool", base class "TestCase" defined the type as "Callable[[TestCase], None]")  [assignment]
__________________________________ dbapi20.py __________________________________
94: error: Need type annotation for "connect_kw_args" (hint: "connect_kw_args: Dict[<type>, <type>] = ...")  [var-annotated]
760: error: Name "test_nextset" already defined on line 731  [no-redef]
_________________________ test_MySQLdb_capabilities.py _________________________
6: error: Library stubs not installed for "MySQLdb"  [import]
148: error: Library stubs not installed for "MySQLdb.constants"  [import]
___________________________ test_MySQLdb_dbapi20.py ____________________________
4: error: Library stubs not installed for "MySQLdb"  [import]
_________________________ test_MySQLdb_nonstandard.py __________________________
3: error: Library stubs not installed for "MySQLdb"  [import]
5: error: Library stubs not installed for "MySQLdb.constants"  [import]
____________________________ test_MySQLdb_times.py _____________________________
7: error: Library stubs not installed for "MySQLdb"  [import]
________________________________ test__mysql.py ________________________________
2: error: Library stubs not installed for "MySQLdb"  [import]
______________________________ test_connection.py ______________________________
3: error: Library stubs not installed for "MySQLdb._exceptions"  [import]
________________________________ test_cursor.py ________________________________
2: error: Library stubs not installed for "MySQLdb.cursors"  [import]
2: error: Library stubs not installed for "MySQLdb"  [import]
7: error: Need type annotation for "_tables" (hint: "_tables: List[<type>] = ...")  [var-annotated]
________________________________ test_errors.py ________________________________
2: error: Library stubs not installed for "MySQLdb.cursors"  [import]
2: error: Library stubs not installed for "MySQLdb"  [import]
7: error: Need type annotation for "_tables" (hint: "_tables: List[<type>] = ...")  [var-annotated]

Environment

No response

How did you install libmysqlclient libraries?

No response

What version of mysqlclient do you use?

2.2.0

Docker command to start MySQL server

No response

Minimum but complete code to reproduce

# Write Python code here.
import MySQLdb

conn = MySQLdb.connect(host='127.0.0.1', port=3306, user='root')
...

Schema and initial data required to reproduce.

-- Write SQL here.
-- e.g. CREATE TABLE ...

Commands, and any other step required to reproduce your issue.

No response

I don't support mypy.
Follow what mypy says:

21: error: Library stubs not installed for "MySQLdb"  [import]
21: note: Hint: "python3 -m pip install types-mysqlclient"
21: note: (or run "mypy --install-types" to install all missing stub packages)
21: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports