Replies: 5 comments 1 reply
-
Technically I see no reason not to provide; but I might be limited in resources and I'm not sure I can provide these files in a timely manner. Let me try to investigate. And for sure any PR:s are more than welcome. Though we have to be careful reviewing supported Python versions under 3.9. |
Beta Was this translation helpful? Give feedback.
-
@moepman I've tried to autogenerate the stub files, but it looks like full auto is difficult next to impossible — I have to fix the stub files manually in order to have it working. So any help in automation is more than appreciated. I see no possibility to manually maintain this big set of the stub files. |
Beta Was this translation helpful? Give feedback.
-
Will this go somewhere on the project roadmap? I'm not familiar enough with how the project works to do it, but if there could be a developer's guide on how you generate the stubs and test them, along with priorities, that would be helpful to have multiple people work on little pieces at a time. My use case for typing might be simpler than others', but I'm not sure. I want Docker containers running in the default bridge mode (but with user-defined networks, as the Docker documentation recommends using) to be able to find the IP of the host so it can make requests to services on the host that:
I try to do that by finding the container's bridge network's gateway IP (ie The type error I get says Here's my code: def find_host_ip_from_docker():
ndb = pyroute2.NDB()
routes_summary = ndb.routes.summary()
routes_summary.select_records(
gateway=lambda g: bool(g),
ifname=lambda i: i == "eth0",
target=lambda t: t == "localhost",
)
routes = list(routes_summary)
route = routes[0]
return route.gateway Thanks and I hope I can be of some help! |
Beta Was this translation helpful? Give feedback.
-
Are you open to in-line type hints? Stubs are OK but they can be more work to keep up to date. |
Beta Was this translation helpful? Give feedback.
-
The static library init is available on the branch https://github.com/svinota/pyroute2/tree/svinota-static-loader-1076 If there will be no negative feedback, it will be merged into the master branch this week. Personally I like it less than usin entry points 'cause of possible CI issues, but if this will help you, then it's ok, as in the end the library is for users, not for the CI :) |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions