{cache-dir}/virtualenvs may be too volatile a storage location for some users
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
Poetry by default saves its virtualenvs in {cache-dir}/virtualenvs
which by default is ~/.cache/pypoetry/virtualenvs
(Linux) and ~/Library/Caches/pypoetry/virtualenvs
(MacOS). However, these folders are generally considered to be safe to be removed: Linux, MacOS
XDG also specifies to use the cache directory for non essential files. (i.e. those that are trivially recreated without user interaction.)
I report this because I emptied the cache on a server and this dropped the in the background running webserver using a poetry virtualenv, unbeknownst to me (luckily it was weekend).
So I recommend to set a different default for the virtualenv folder. If you follow XDG specifications that would probably be ~/.local/share/poetry/virtualenvs (FYI: Pipenv already uses ~/.local/share/virtualenvs
), and there is probably an similar folder for MacOS.
(Default virtualenvs folder for Windows should probably be fine.)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:7 (1 by maintainers)
This bug just bit me hard on MacOS. Optimization software like CleanMyMac will clear out
~/Library/Caches/
periodically, wiping out packages downloaded by poetry. They’ve (correctly IMO) pointed to the Apple technical docs that pretty clearly indicate that this directory shouldn’t include any files that applications depend on and can’t recreate themselves (e.g. “the application does not require cache data to operate properly, but it can use cache data to improve performance”).This seems like a valid and well-documented design decision, and one that
poetry
should respect out-of-the-box. Since python apps aren’t typically expected to be able to re-install required libraries on their own (!), shouldn’t a different default cache location be used on MacOS?Yes, but I found that out when it already went wrong 😃 (I wouldn’t expect people to completely read the docs, especially for a package manager. So, any rm happy person can make the same mistake as me.)
But it would really be nice to have a more saner default instead. I think
~/.local/share/poetry/virtualenvs
would be the perfect location (just as Pipenv does it) and for MacOS that is as it seems~/Library/Application Support/poetry/virtualenvs
or just~/Library/poetry/virtualenvs