Skip to content
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 sortedcontainers #8731

Closed
wants to merge 12 commits into from
Closed

Add stubs for sortedcontainers #8731

wants to merge 12 commits into from

Conversation

jakob-keller
Copy link

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

@github-actions

This comment has been minimized.

@jakob-keller
Copy link
Author

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

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title Stubs/sortedcontainers Add stubs for sortedcontainers Sep 13, 2022
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

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

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2022

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

@jakob-keller jakob-keller closed this by deleting the head repository Feb 14, 2023
@jakob-keller
Copy link
Author

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

@JWCS
Copy link

JWCS commented Feb 16, 2023

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

@jakob-keller
Copy link
Author

jakob-keller commented Feb 16, 2023

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.

@JWCS
Copy link

JWCS commented Feb 17, 2023

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

@Jeremiah-England
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add stubs for sortedcontainers
4 participants