cloudpathlib
cloudpathlib copied to clipboard
Pycharm debugger triggers cache download on breakpoints
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
Seems i missed this discussion #315 about why .fspath caches the file
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.
@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.