This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author carljm
Recipients brett.cannon, carljm, eric.snow, lukasz.langa, ncoghlan
Date 2018-05-14.15:12:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2018-05-14 15:12:49carljmsetrecipients: + carljm, brett.cannon, ncoghlan, lukasz.langa, eric.snow
2018-05-14 15:12:49carljmsetmessageid: <>
2018-05-14 15:12:49carljmlinkissue33499 messages
2018-05-14 15:12:49carljmcreate