cloudpathlib icon indicating copy to clipboard operation
cloudpathlib copied to clipboard

Pycharm debugger triggers cache download on breakpoints

Open Happyzippy opened this issue 2 years ago • 3 comments

How to replicate:

  • Run pycharm debugger
  • Create CloudPath object
  • Break and click on the item in the debugger to inspect

Alternatively:

  • CloudPath(...).fspath

Why: Pycharm debugger collects all properties on objects in scope, thus accessing .fspath which performs a cache refresh

Happyzippy avatar Feb 10 '23 13:02 Happyzippy

Seems i missed this discussion #315 about why .fspath caches the file

Happyzippy avatar Feb 10 '23 13:02 Happyzippy

This does sound annoying, but I'm unsure about whether there is a sensible solution on our end given the other uses of .fspath. Is there a way to prevent the PyCharm debugger from collecting all properties on the object? I imagine this can't be the only situation where forcing all properties on all objects in scope to compute leads to undesirable side effects.

jayqi avatar Feb 11 '23 23:02 jayqi

@pjbull I was thinking about this case some more, and I think this supports the strategy that we want to implement #322 and remove support for .fspath.

It's a convention/expectation in Python development that properties should be cheap and not have side effects, so I think we violate the principle of least surprise here by having the .fspath property refresh the cache.

jayqi avatar Mar 16 '23 17:03 jayqi