svinota / pyroute2

Python Netlink and PF_ROUTE library — network configuration and monitoring
https://pyroute2.org/
Other
960 stars 248 forks source link

Provide stub files #911

Open svinota opened 2 years ago

svinota commented 2 years ago

Discussed in https://github.com/svinota/pyroute2/discussions/880

Originally posted by **moepman** February 14, 2022 I wonder if it would be possible to provide stub files [1] which would help type checkers such as mypy or code completion for IDEs such as PyCharm [2]. [1] https://www.python.org/dev/peps/pep-0484/#stub-files [2] https://youtrack.jetbrains.com/issue/PY-51039
socketpair commented 2 years ago

Possible remove dynamic module loading ? I would hardcode all modules in root __init__.py

Update to latest version broke our build system :( because mypy says:

xxx.py:7:0: E0611: No name 'IPRoute' in module 'pyroute2' (no-name-in-module)
vincentchov commented 2 years ago

I agree with @socketpair, I think that might help. Right now, my type checker doesn't even know that NDB() exists. See comment here