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
Exclude __pycache__ directories from backups using CACHEDIR.TAG #85253
Comments
It'd be nice of __pycache__ directories didn't pollute backups. Granted, one can add __pycache__ directory to their backup-tool-of-choice exclusion list, but those lists are ever growing and maybe it'd be good to help the tools and the users. There's a Cache Directory Tagging Specification[1] which some backup tools like Borg, restic, GNU Tar and attic use out of the box (well, with a switch) and other tools (like rsync, Bacula, rdiff-backup and I imagine others) can be made to use it with a generic exclude-directories-with-this-file-present option (partially, just the existence of the tag file is used, not its content). I wasn't sure what to select in Components, so I went with Library. |
To spoil it for other readers: the linked page says to create a file named CACHEDIR.TAG with a specific first line. |
I'm not sure what I think about this. I get the desire, but the file isn't a standard either. |
What are the downsides of doing this? |
It's not a standard in an RFC kind of sense but it's somewhat recognizable in the backup software world – I know that Borg, rustic and restic support it. |
Some other tools which follow this already are mypy, pytest, pipx, cargo (Rust). I think it's a good idea, things like this are a real pain point when using backup software even if the impact of |
It doesn't seem to hurt, beyond the obvious "code to maintain" burden, and seems to have adoption as a de facto standard, so I'd be +1. @jstasiak would you be able to benchmark if the difference of writing an additional file is noticeable for import time? If it has a measurable impact beyond the noise, we may consider an opt-out config setting for those who don't care about writing the file and want imports as fast as possible. A |
Yes, I'll try to run some tests. |
So I brought this up on the core dev Discord server and either got objections or lukewarm reaction. The biggest sticking point is this is no way a standard and us doing this would make it a de-facto one. As such, I'm afraid I need to close this until some standards body picks it up. |
__pycache__
directories from backups usingCACHEDIR.TAG
#21060Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: