[issue33499] Environment variable to set alternate location for pycache tree

Nick Coghlan report at bugs.python.org
Thu May 17 08:14:04 EDT 2018


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Regarding environment variables, note that they get used in two *very* different ways:

1. The "persistent shell setting" case that Raymond describes. While setting PYTHONBYTECODEPATH to always point to a RAM disk could make quite a bit of sense for some developers, it's more likely that this case would be associated with tools like `pipenv shell`.

2. The "inheritable process setting" case, where you prepend the environment variable setting to a shell command, or add it to the env dict in a Python subprocess call.

Anywhere that I used this setting, I'd want it to be passed along to child processes, so an environment variable would be a lot more useful than a command line option.

If we did add an option, then a named -X option would probably make the most sense.

Regarding the state caching: having this be read once at startup would help avoid a lot of potential for weird state inconsistencies where some modules were loaded from one cache directory, while later modules were loaded from a different one.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33499>
_______________________________________


More information about the Python-bugs-list mailing list