Skip to content
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

Store pip/setuptools/wheel copies under user_cache_dir instead of user_data_dir #1884

Open
dgelessus opened this issue Jul 3, 2020 · 7 comments

Comments

@dgelessus
Copy link

What's the problem this feature will solve?
virtualenv uses the location returned by appdirs.user_data_dir(...) to store downloaded and extracted copies of pip/setuptools/wheel. Because these files can be easily redownloaded/reextracted if they are missing, it would be better to put them under appdirs.user_cache_dir(...). This points into a standard cache directory like ~/.cache (XDG) or ~/Library/Caches (macOS), which is recognized by the system and programs as "not important" and will be excluded from backups, can be deleted if disk space is needed, etc.

Describe the solution you'd like
Use appdirs.user_cache_dir(...) for files that can always be easily redownloaded/regenerated, and use appdirs.user_data_dir(...) only for user data that cannot be recreated.

@dgelessus
Copy link
Author

dgelessus commented Jul 3, 2020

Related: the default config file location is also under user_data_dir(...). For that it would be more appropriate to use user_config_dir(...), which points under ~/.config in XDG environments and under ~/Library/Preferences on macOS. (Of course the previous location under user_data_dir(...) would still need to be supported for compatibility.)

Nevermind that - virtualenv already uses user_config_dir(...), but with the latest release version of appdirs that points into ~/Library/Application Support and not ~/Library/Preferences (this has been changed in the appdirs repo, but not released yet).

else Path(user_config_dir(appname="virtualenv", appauthor="pypa")) / "virtualenv.ini"

@gaborbernat
Copy link
Contributor

I think this is an upstream issue.

@dgelessus
Copy link
Author

The second part (virtualenv.ini location) is an upstream appdirs/platformdirs issue, yes. The first part (cache location) is a virtualenv issue though.

@gaborbernat gaborbernat reopened this Jun 27, 2023
@gaborbernat
Copy link
Contributor

Please put in a PR with that change 👍

@tushar5526
Copy link

Hey, I was looking into the codebase for this and as we can also support creating symlinks, I am assuming the complete behaviour is to store data in app-data if we use the symlink method to link pip/wheels/setuptools otherwise default to using cache-dir?

The virtualenv breaks if I delete app-data after creating a virtualenv with --symlink-app-data flag.

Also on a side note, the plugin based implementation is so clean!

@tushar5526
Copy link

@gaborbernat I would also love to hear your thoughts on the following.

I am assuming the complete behaviour is to store data in app-data if we use the symlink method to link pip/wheels/setuptools otherwise default to using cache-dir?

I can then go ahead and start the implementation :D

@gaborbernat
Copy link
Contributor

Well in both cases should be app data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@gaborbernat @dgelessus @tushar5526 and others