-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Feature request: Cache directory environment variable #7016
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
Comments
I think it may be a reasonable thing to add, please go ahead with a PR. |
I'm happy to provide an implementation however the one thing that is still not obvious to me is whether the environment should take precedence over the config file or the other way around. Making the environment variable take precedence would give any wrapper scripts ultimate control, however it seems like in some circumstances this could lead to unexpected results as a localised config file option may be unexpectedly overridden by a more global environment setting. I think I would err on the side of removing potentially confusing situations at the cost of perhaps reducing the power of this feature and make the config file take precedence over the environment variable. Any thoughts? |
I would try to match behaviour here with the one of |
That would have been ideal but for |
Well, but when you merge something, one part goes first, and another goes last, why can't we have the same "order" here? |
Sure I can do that. It's just that that order makes the environment variable take precedence. I mean it should be fine as long as it's clear that the environment variable should not be used as a default fallback and I can clarify that in the documentation. |
This adds an environment variable MYPY_CACHE_DIR which can set the current cache directory. This variable will override the cache_dir setting in the configuration but can be overridden via the command line. Fixes python#7016.
The cache directory can currently be customised using the --cache-dir argument. It would be convenient to also be able to do this using an environment variable akin to the MYPYPATH variable.
For very large projects that are not pure Python and contain multiple Python packages within the source tree, both the search path and cache directory often need to be customised for the entire project. Being able to do this via the environment is very convenient. Additionally, environment variables can often provide more flexible options when dealing with wrapper tools.
I would be happy to provide the implementation if this feature is considered reasonable.
The text was updated successfully, but these errors were encountered: