typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Add stubs for `sortedcontainers`

Open jakob-keller opened this issue 3 years ago • 6 comments

This PR adds stubs for sortedcontainers (closes #8574).

jakob-keller avatar Sep 12 '22 18:09 jakob-keller

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 12 '22 18:09 github-actions[bot]

OK, I'll look into the failing tests...

jakob-keller avatar Sep 12 '22 18:09 jakob-keller

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 12 '22 19:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 12 '22 19:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 12 '22 19:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Sep 12 '22 19:09 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 03 '22 17:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 03 '22 19:10 github-actions[bot]

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 :)

AlexWaygood avatar Oct 03 '22 21:10 AlexWaygood

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 03 '22 21:10 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 06 '22 23:10 github-actions[bot]

Sorry, I was unable to finish this project since I migrated away from sortedcontainers in the meantime.

jakob-keller avatar Feb 14 '23 12:02 jakob-keller

@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?

JWCS avatar Feb 16 '23 22:02 JWCS

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.

jakob-keller avatar Feb 16 '23 22:02 jakob-keller

Thanks for the insight & hard work! I guess I'll just stick to beartyping it in the meantime

JWCS avatar Feb 17 '23 18:02 JWCS

There is now a sortedcontainers-stubs package on PyPI: https://github.com/h4l/sortedcontainers-stubs

Jeremiah-England avatar Dec 19 '23 13:12 Jeremiah-England