Public interface to customize CACHE_ROOT_DIR
The new kwarg works for me in Python 3.9.0.
and while setting the cache_root_dir on the cache object works (and will continue to work) as Kim alluded to it involves setting a property in a “core” module (synapseclient.core.cache) which is not ideal as it’s intended to be semi-private. It’ll continue to be accessible at that property so we don’t break code that is relying on this, but has added an optional cache_root_dir kwarg to the Synapse constructor to allow setting this on a per instance basis and via a documented argument.
Can you validate that this works for you since you have both commented on this issue.
If you would like to install the release candidate that this is a part of it can be installed e.g.
pip3 install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple "synapseclient>=2.3.0"
, do not depend on its yet. In version 2.0, I will document that the client has a cache, and expose some functions to work with the cache. This is definitely be one of them. But the way to call it may be different. I’m not sure yet. I will keep this ticket so that you can test it out though.
I was able to change the cache directory by setting syn.cache.cache_root_dir (`syn` being an already initialized Synapse object).
With 's comment, it seems like the cache directory is already “customizable” if users know when to use it (before initializing the Synapse object). I would like to learn more about if there is a need to change the cache directory after the Synapse object is initialized? And if it makes sense to do so.
If not, we just need to document what James said.