-
Notifications
You must be signed in to change notification settings - Fork 204
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 stub files for SortedList, SortedSet #136
Conversation
I can come up with type stubs for SortedDict later |
I agree. It’s time to merge type hints. I’d like to put them inline with the code and drop Python 2 support. Would you be willing to do that work? You also found the other existing work to add type hints. Do yours match theirs? |
@grantjenks I added a new stub file for
Yes! we were talking about the same thing in the discussion. There are three ways to add type hints, and they can be mixed.
Some more functionalities from build-in
Write So just for type hinting's sake, it's actually not necessary to drop python 2 support. We can write inline comments. A bonus is package For my pull request, I chose stub files because it looks the most non-invasive and I wish my pull request gets accepted :) |
My bad! There are actually two typing backports. One is just called I noticed the appveyor build failed cuz of python3.4. I'd like to add Just a reminder, python has officially dropped support for python 3.4, some of the tools I know already moved along, like pytest, colorama. It's a possibility to drop python3.4 too here. |
From pytest's documentation:
So python 3.4 actually ends earlier than python2.7 Also I noticed the build for python3.4 in appveyor still failed. It's very concerning that line 45 shows pytest 5.x was installed. As pytest 5.x dropped python3.4 support and pytest 4.x should be used. I suggest python3.4 support should be dropped. Or we can try to further limit pytest version to 4.x |
Any progress on this? |
Closing in favor of https://pypi.org/project/sortedcontainers-stubs/ |
Hi, I really love this repo and have to submit this pull request!! static typing in python is really a thing now. Modern IDE does static analysis with type hints to autofill and to find code errors. Also, the official static type analysis tool
Mypy
is wildly accepted.I think type hinting is especially important to SortedContainers as it's a data structure package and most people will spread the usage across their code. Enabling type hinting will give tremendous support in users' code.
This pull request implemented type hinting for
sortedlist
as per PEP 518. The process is non-destructive with almost only one additional file.This is a screenshot with a piece of sample code using the type-enabled SortedList. It's shown that the IDE Pycharm is able to correct basic errors with type hinting.