typeshed
typeshed copied to clipboard
Add stubs for `sortedcontainers`
This PR adds stubs for sortedcontainers (closes #8574).
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
OK, I'll look into the failing tests...
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Thanks for your work here, and sorry we've taken so long in getting to this!
The new mypy release is picking up on a few bugs in the PR that weren't picked up by mypy 0.971. I'm going to push to your branch to fix those, so that we can move on to the stubtest/pyright errors :)
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Sorry, I was unable to finish this project since I migrated away from sortedcontainers in the meantime.
@AlexWaygood Just started using sortedcontainers, and I noticed that adding type support for the library has been a ~6 year process, but this still seems like the closest initiative to getting types pip-installable. What are the remaining actions needed to move this to completion? Checking the logs, some of which have been tossed, it was almost there?
At first glance, sortedcontainers appears to be a natural fit for type hints. The potential benefits for users are obvious.
For me, the project turned out to be way less straightforward than anticipated. For example, if I recall correctly, sortedcontainers does some unusual (?) overloading of constructors whose return type depends on whether the key argument is provided or not. That does not play well with generic types that I was trying to introduce. And I believe there was more complexity along those lines.
My general impression became that sortedcontainers keeps true to its goal of being highly performant and might not value idiomacy as much as would be beneficial for extensive type hints.
It would have been feasible to prepare a severely limited initial set of stubs, but the benefits would be minimal and I have moved on in the meantime. Feel free to use my work in any way you like or let me know if you have any questions.
Thanks for the insight & hard work! I guess I'll just stick to beartyping it in the meantime
There is now a sortedcontainers-stubs package on PyPI: https://github.com/h4l/sortedcontainers-stubs