-
Notifications
You must be signed in to change notification settings - Fork 629
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
Provide type hints #243
Comments
Agreed. A pull request would be welcome ;-) |
I have submitted PR #247 which could be seen as a preliminary thing to do before doing type hints. Full type hinting needs Python 3.6, and type hinting on just functions needs Python 3 anyway, so Python 2 support may as well be removed since it won't even parse on there if this is added in a nice way. |
One could rebase Simplexum@b275373 |
I don't think that it would be that simple, there was significant incompatibe changes made at this stage. But it could cover some portion of the code, and maybe that could save some code-editing time. It would need careful review afterwards, as any automated, but not-straightforward code change |
I think Python 2 is EOL for a long time anyway, is there a good reason to support it? I noticed that some type hints can use a separate library that makes them work for older versions. I'm not a Python expert, don't know the specifics but it seems to work at least in some cases. |
Python2 is declared unsupported since v0.11.0 (in release-notes for v0.10.2, "Note: this will be the last release of python-bitcoinlib with Python 2.7 compatibility."), I believe what @ysangkok meant is that the code that deals with python2/3 compatibility shall be removed, and this is the focus of #247 There's a style of type hints that can be specified as comments, like Python3.6 is also the lowest supported version of python3 (https://pythoninsider.blogspot.com/2020/10/python-35-is-no-longer-supported.html), so I think that targeting it, and ditching version 3.5 and lower is sensible. |
Because bitcointx uses type hints directly expressed in source (only supported since python3.6) taking type hint code from bitcointx would transfer the python3.6 requirement of bitcointx to bitcoinlib. |
Sounds good, even Debian stable, which is quite conservative has Python 3.7.3 already, so it should be safe, I think. |
I hope the benefits for possibly security-critical library are obvious.
The text was updated successfully, but these errors were encountered: