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 boltons #8892

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

add boltons #8892

wants to merge 44 commits into from

Conversation

AABur
Copy link

@AABur AABur commented Oct 13, 2022

add stubs for boltons library

@AABur
Copy link
Author

AABur commented Oct 13, 2022

@sobolevn
Please review the bolton/dictutils stubs
This is my first PR in typeshed and there is for sure room for improvement.

@github-actions

This comment has been minimized.

sobolevn
sobolevn previously requested changes Oct 15, 2022
Copy link
Member

@sobolevn sobolevn left a comment

Thanks, this is good start.

I think we would need to:

  1. Fix flake8. Right now it says:
 ./stubs/boltons/boltons/timeutils.pyi:46:20: F821 undefined name 'DSTEND_1987_2006'
./stubs/boltons/boltons/funcutils.pyi:45:5: F811 redefinition of unused 'get_sig_str' from line 43
./stubs/boltons/boltons/funcutils.pyi:46:5: F811 redefinition of unused 'get_invocation_str' from line 44
./stubs/boltons/boltons/funcutils.pyi:54:5: F811 redefinition of unused 'add_arg' from line 53
./stubs/boltons/boltons/urlutils.pyi:92:1: F811 redefinition of unused 'OrderedMultiDict' from line 5
./stubs/boltons/boltons/deprutils.pyi:5:26: F821 undefined name 'ModuleType'
./stubs/boltons/boltons/ioutils.pyi:5:13: F821 undefined name 'unicode'
./stubs/boltons/boltons/tbutils.pyi:3:8: F821 undefined name 'unicode'
./stubs/boltons/boltons/fileutils.pyi:50:12: F821 undefined name 'copy_tree'
./stubs/boltons/boltons/iterutils.pyi:66:5: F811 redefinition of unused '__next__' from line 65
./stubs/boltons/boltons/iterutils.pyi:72:5: F811 redefinition of unused 'reseed' from line 71

You need to define / import all missing names.

  1. Mypy and other tools must pass, there are multiple issues there at the moment. For example,
stubs/boltons/boltons/listutils.pyi:26: note:      Superclass:
stubs/boltons/boltons/listutils.pyi:26: note:          @overload
stubs/boltons/boltons/listutils.pyi:26: note:          def sort(self, *, key: None = ..., reverse: bool = ...) -> None
stubs/boltons/boltons/listutils.pyi:26: note:          @overload
stubs/boltons/boltons/listutils.pyi:26: note:          def sort(self, *, key: Callable[[Any], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]], reverse: bool = ...) -> None
stubs/boltons/boltons/listutils.pyi:26: note:      Subclass:
stubs/boltons/boltons/listutils.pyi:26: note:          def sort(self) -> None

The only way to fix it is to add # type: ignore to the method definition line: def sort(self) -> None: # type: ignore

stubs/boltons/boltons/cacheutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/cacheutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/cacheutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/iterutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/iterutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/tbutils.pyi Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@AABur
Copy link
Author

AABur commented Oct 16, 2022

flake8 & mypy FIXED

--- TEST SUMMARY: One or more tests failed. See above for details. ---

Flake8: Success
Check consistent: Success
Check new syntax: Success
Pyright: Success
mypy: Success
stubtest: Failed
pytype: Success
Regression test: Success

Time to dive into designing the correct stubs

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Nov 8, 2022

Thanks @AABur. Are you able to take a look at the stubtest errors in CI? Please say if you need guidance on any of them :)

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

stubs/boltons/boltons/ecoutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/ecoutils.pyi Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@AABur AABur requested review from sobolevn and AlexWaygood and removed request for sobolevn Nov 27, 2022
@AlexWaygood
Copy link
Member

AlexWaygood commented Nov 27, 2022

@AABur, is this PR ready for a complete review, or do you just want help on the stubtest error for now? (I'm asking because this PR is still marked as a "draft PR" currently 🙂.)

@AABur AABur marked this pull request as ready for review Nov 27, 2022
@AABur
Copy link
Author

AABur commented Nov 27, 2022

@AABur, is this PR ready for a complete review, or do you just want help on the stubtest error for now? (I'm asking because this PR is still marked as a "draft PR" currently 🙂.)

Ready for the complete review now!

@github-actions

This comment has been minimized.

@AABur
Copy link
Author

AABur commented Dec 4, 2022

@AlexWaygood sorry to bother you, but it's been a week. Any chance of my PR being accepted, or will there be any constructive comments?

@AlexWaygood
Copy link
Member

AlexWaygood commented Dec 4, 2022

Thanks for the ping @AABur. I haven't had a chance to have a look at this yet (we've got little bit of a backlog at the moment, and we're all volunteers!). I haven't forgotten, and I'll try to take a look soon 🙂

@AlexWaygood AlexWaygood dismissed sobolevn’s stale review Dec 11, 2022

The requested changes were made

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2022

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

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Thanks @AABur! This looks like a good start, but there's a few things that need fixing; see my comments below.

In general, I'm a bit confused by how much commented-out code there is. Either something exists at runtime (in which case it should be included in the stub), or it doesn't. There shouldn't really be much of a need, if any, to include large chunks of commented-out code in typeshed. If you are including a large chunk of commented-out code, you need to explain why it's commented-out, or it's very confusing.

Similarly, we don't really need the # TODO: DONE comments everywhere. TODO comments are for when there's something in a file that needs more work in the future :)

stubs/boltons/boltons/cacheutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/debugutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/deprutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/dictutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/easterutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/statsutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/strutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/tbutils.pyi Show resolved Hide resolved
stubs/boltons/boltons/timeutils.pyi Outdated Show resolved Hide resolved
stubs/boltons/boltons/urlutils.pyi Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2022

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

@AABur
Copy link
Author

AABur commented Dec 21, 2022

@AlexWaygood you are correct! I should have removed the comment-out code carefully before doing the PR
DONE!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 21, 2022

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

@AlexWaygood AlexWaygood self-requested a review Dec 21, 2022
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.

None yet

4 participants