Skip to content

[Feature request] Support for typing hints #493

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

Closed
pjljvandelaar opened this issue Jan 20, 2021 · 3 comments
Closed

[Feature request] Support for typing hints #493

pjljvandelaar opened this issue Jan 20, 2021 · 3 comments

Comments

@pjljvandelaar
Copy link

pjljvandelaar commented Jan 20, 2021

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!

@robsdedude
Copy link
Member

Add type hints

@robsdedude
Copy link
Member

Thanks for the suggestion. I've added the idea to our internal Trello wall. I can't promise that it will happen, though. Definitely not in the near future as other things have higher priority right now.

@robsdedude
Copy link
Member

robsdedude commented Aug 30, 2022

Good news. The first draft of type hints will be released soon in version 5.0.0a2

#767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants