New submission from Carl Meyer <c...@oddbird.net>: We would like to set an environment variable that would cause Python to read and write `__pycache__` directories from a separate location on the filesystem (outside the source code tree). We have two reasons for this:
1. In our development setup (with a webserver running in a container on the dev-tree code), the `__pycache__` directories end up root-owned, and managing permissions on them so that they don't disrupt VCS operations on the code repo is untenable. (Currently we use PYTHONDONTWRITEBYTECODE as a workaround, but we have enough code that this costs us multiple seconds of developer time on every restart; we'd like to take advantage of cached bytecode without requiring that it pollute the code tree.) 2. In addition to just _having_ cached bytecode, we'd like to keep it on a ramdisk to minimize filesystem overhead. Proposal: a `PYTHON_BYTECODE_PATH` environment variable. If set, `source_from_cache` and `cache_from_source` in `importlib._bootstrap_external` will respect it, creating a directory tree under that prefix that mirrors the source tree. ---------- messages: 316518 nosy: brett.cannon, carljm, eric.snow, lukasz.langa, ncoghlan priority: normal severity: normal status: open title: Environment variable to set alternate location for pycache tree type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33499> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com