Skip to content

[Feature request] Support for typing hints #493

@pjljvandelaar

Description

@pjljvandelaar

I would like to use the full capability of mypy while using neo4j.

However, neo4j driver is not annotated for that purpose.
One gets

example.py:4: error: Skipping analyzing 'neo4j': found module but no type hints or library stubs
example.py:4: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports

Adding # type: ignore after the import from neo4j import GraphDatabase as suggested on the provided html page only partly solves the problem.
I no longer am able to use the flag --disallow-any-expr on my complete archive.
On all neo4j related lines I now get:

example.py:17: error: Expression has type "Any"
example.py:19: error: Expression has type "Any"
example.py:22: error: Expression has type "Any"
example.py:30: error: Expression has type "Any"
example.py:31: error: Expression has type "Any"
example.py:33: error: Expression has type "Any"
example.py:35: error: Expression has type "Any"

So please add type annotations to the neo4j driver: I expect that it will prevent many subtle error in my and other user's code.
For me working with untyped graphs feels like walking a tight rope without a safety net!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions