Skip to content
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

allow users to set cache_directory via env-var #1965

Closed
woutervh opened this issue Oct 10, 2023 · 9 comments
Closed

allow users to set cache_directory via env-var #1965

woutervh opened this issue Oct 10, 2023 · 9 comments

Comments

@woutervh
Copy link

jedi is mostly installed in a virtualenv, but uses $XDG's ~/.cache/jedi , which is a good default / fallback.

Many python tools/libs allow the user to set the cache_dir via env-var:
BLACK_CACHE_DIR
MYPY_CACHE_DIR
RUFF_CACHE_DIR
....

please support an env-var JEDI_CACHE_DIR

@davidhalter
Copy link
Owner

Why?

@woutervh
Copy link
Author

because libraries installed in a virtualenv should not write to hardcoded externals dirs like ~/.cache/jedi.
XDG-directories are a very good default, but they should still remain default.

and setting XDG_CACHE_HOME to some project-specific dir only creates other issues.

@woutervh
Copy link
Author

and because I want to avoid monkeypatching :)

@davidhalter
Copy link
Owner

But this does not explain when you would use this?

@woutervh
Copy link
Author

I never use jedi directly but subdependencies in many of my projects are.

The whole idea of virtualenvs is to provide a certain isolation from the rest of the system and the ability to run many versions in parallel. Writing to $HOME runs counter to that.

@woutervh
Copy link
Author

this does not explain when you would use this?

I'm not understanding your question.
I never want a virtualenv-installed python library to write to $HOME.

So when would I use this JEDI_CACHE_DIR? In every project that depends on jedi.

@davidhalter
Copy link
Owner

But how do you set this? Do you really set this variable by hand in every venv?

@woutervh
Copy link
Author

woutervh commented Oct 13, 2023

I set env-vars in a .env and pip install autoread-dotenv to automatically process the .env.

see https://autoread-dotenv.readthedocs.io/ ( I wrote this package)

examples:

@davidhalter
Copy link
Owner

davidhalter commented Oct 13, 2023

Sorry, this feels not important enough for me. I'm closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants