Skip to content

Display lru_cache cache_info in very verbose mode? #4249

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

Closed
blueyed opened this issue Oct 26, 2018 · 4 comments
Closed

Display lru_cache cache_info in very verbose mode? #4249

blueyed opened this issue Oct 26, 2018 · 4 comments
Labels
topic: reporting related to terminal output and user-facing messages and errors type: enhancement new feature or API change, should be merged into features branch

Comments

@blueyed
Copy link
Contributor

blueyed commented Oct 26, 2018

With the recent addition of functools.lru_cache it might make sense to display its cache_info with -vvv or some other flag, which would be helpful when investigating performance.

For this it might make sense to wrap it into a separate module, so that it is easier to handle all of them (currently just one, but two already with #4247).

@blueyed blueyed mentioned this issue Oct 26, 2018
3 tasks
@nicoddemus nicoddemus added type: enhancement new feature or API change, should be merged into features branch topic: reporting related to terminal output and user-facing messages and errors labels Oct 26, 2018
@nicoddemus
Copy link
Member

Sounds good. The idea is to show cache_info for all lru_cache-decorated functions?

@blueyed
Copy link
Contributor Author

blueyed commented Oct 26, 2018

Yeah.

@asottile
Copy link
Member

Maybe instead of hooking into -v (I often spam -vvvvv since I can't remember how many it is and surely a few extra won't hurt -- and I don't think this info will be helpful in that case), we add a plugin that's something along the lines of --show-lru-cache-info?

@asottile
Copy link
Member

@isidentical is looking into taking this one -- we're discussing some implementation details about this

what I think we're going to do for a first pass is:

  • add a new plugin module to handle "internal pytest... stuff" for lack of a better name (maybe debug? internal? meta? idk, naming is hard)
  • in this module, add an option like above
  • add a reporting mechanism that uses pkgutil or some such to iterate through the _pytest namespace looking for globals with lru_cache attached

or something like that? thoughts?

@blueyed blueyed closed this as completed Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: reporting related to terminal output and user-facing messages and errors type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

3 participants