-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add stubs for "netifaces" package #12854
Conversation
PR updated with improved types contributed by @J-M0 here: al45tair/netifaces#77 |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Thanks, good idea!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Please be aware that we are currently adopting a new policy for unmaintained third-party stubs. It may be possible we will again remove these stubs if they start causing issues.
stubs/netifaces/netifaces.pyi
Outdated
@@ -0,0 +1,74 @@ | |||
from typing import Dict, List, Tuple, Union, Literal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these – except Literal
should be imported. Please use built-in types (dict
, list
, tuple
) and new-style union syntax X | Y
. (I thought our tests would complain about this, but they didn't ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
stubs/netifaces/netifaces.pyi
Outdated
@@ -0,0 +1,74 @@ | |||
from typing import Dict, List, Tuple, Union, Literal | |||
|
|||
AF_12844: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all be marked Final[int]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done as well.
Hey all, It so happens that I actually revisited these stubs I made a while ago and made some significant improvements, but never published them because I didn't think there was any interest. Is there any way we can integrate them into this? |
Thanks @J-M0! There's a couple of approaches:
If the changes you're making are mostly about expanding the coverage (e.g., adding more types), then I'd advocate for the first one; it's good to start with simpler stubs and make them more comprehensive over time. If you're fixing incorrect types, then it's better to get them right the first time. |
@JelleZijlstra, the work I've done is mostly about making the return type for the I've pushed my changes here so you can see them: https://github.com/J-M0/netifaces/blob/5dc562a0083b2a24f4fba33257a9b1aa654a3782/netifaces-stubs/__init__.pyi. Let me know how you think we should proceed. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Hey @J-M0, thanks for chiming in with additional improvements! I updated my PR to use PEP 585 and add |
@srittau How long would it take for the changes to become available as |
Packages are built nightly (UTC time). |
Hi.
I generated stub files for the
netifaces
library.Unfortunately, this library is no longer maintained (although still working well). For this reason, I would like to submit type hints to
typeshed
.I compared to the types created initially by @jolaf in al45tair/netifaces#39 and it seems to match well.