Skip to content

Update cachetools to 5.0.0 - #7455

Merged
AlexWaygood merged 9 commits into
python:masterfrom
Akuli:cachetools
Mar 8, 2022
Merged

AlexWaygood merged 9 commits into
python:masterfrom
Akuli:cachetools

Conversation

@Akuli

@Akuli Akuli commented Mar 7, 2022

Copy link
Copy Markdown
Collaborator

No description provided.

@Akuli
Akuli marked this pull request as ready for review March 7, 2022 22:42
# referenced exist anymore
cachetools\..*\.__(get|set|del)item__ # has extra argument
cachetools\..*TTLCache.__repr__
# stubs omit defaulted arguments that are meant to be optimizations, not provided by user

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it hurt that much to include the weird extra arguments in these signatures? I worry that if we allowlist all these functions, stubtest won't warn us if there are any other problems with any of them

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these allowlistings correspond with a def statement in the stubs. They are all inherited from other classes that don't have the extra arguments. So if we define something incorrectly in the stubs, we'll get a new stubtest error that points at the definition.

@Akuli Akuli Mar 8, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And after thinking about this a bit more: Including the weird extra arguments also would mean including a new method definition for each of the lines I allowlisted. That would clutter the stubs and not help users in any way. CI checks should catch problems, not force you to do something weird and unnecessary IMO.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good! Will try to do a full review of the rest of the PR soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side point: I'm amazed a library that's concerned with such micro-optimisations is also using functools.total_ordering in the same module.

Comment thread stubs/cachetools/cachetools/__init__.pyi

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, other than the point I've raised about the TODO comment.

@AlexWaygood
AlexWaygood merged commit 6c967d4 into python:master Mar 8, 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.

2 participants