-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Suggestion: keep sys.path per Evaluator instance #384
Comments
This could also be useful to implement some kind of library view or a package manager in an IDE, e.g/ to retrieve the list of modules currently installed and their docstrings. It would also be great if it could support virtual envs. |
Once my suggestion is in, it is straight forward to support virtualenv. It can be done by just adding |
Awesome! |
Also covers #371.
It's actually more, e.g.: I would propose to add something like @tkf I agree with the whole proposal. However, I don't think it goes far enough. We should get rid of all global state. We could easily do that by just cloning the |
Why not just take a list of virtual environments? For example, you could have different set of modules in
I think it is OK, but you may want to think about it more, if you want to consider deletion of sys.path. Someone might want to know completion given modules in a subset of sys.path. In that case, we need to tell Jedi to ignore the actual sys.path and only consider the given paths.
Sounds good.
I prefer if you go to multi-processing direction, since emacs-jedi already launches multiple Jedi processes from an Emacs process. I am bit scary about cache right now, but well, if you mess up with cache then you just have to delete it. But if Jedi handles multiprocessing nicely that would be cool. Anyway, this is not scope of this issue. |
So just
You're probably right, it doesn't matter for the plugin developer and it's good to have that option (not that I will ever use it). I wanted to keep it simple, but I guess a list instead doesn't hurt.
I agree and I totally share your concerns about the cache. But that doesn't change anything, for multithreading. People have used Jedi without noticing that it doesn't support multithreading yet, so I'd like to support it. |
Then include_sys_path = True
sys_path_insertions = []
virtualenv_paths = [] And sys_path is composed by something like: sys_path = settings.sys_path_insertions
sys_path += map(get_env_path, settings.virtualenv_paths)
if settings.include_sys_path:
sys_path += sys.path Sounds nice. I'd use something like |
Hmm, I don't know, that's three settings instead of two. Just thinking out loud - Why not like this:
->
If you don't want certain parts of the An option would be to make |
Why not just have But I don't know if |
That's what I mean, sorry I copied the wrong bits.
We cannot use virtualenv directly, because it's not in the standard lib. I don't think a dependency just for this is a good idea. But thank you for the hint. |
Then maybe we should drop virtualenv support completely (i.e., not having |
There is no |
Right, I mean current VIRTUAL_ENV treatment in Jedi does not work with Windows etc. Just look at how complex
|
Fixed by #636. |
Currently Jedi uses sys.path directly and so editors have to modify sys.path in order to tell where modules locate. This is not ideal. For example, users may want to add Python 3 modules to sys.path while running Jedi in Python 2 (e.g., to write Python 2/3 compatible module). To do that, I suggest to keep additional paths in a place other than sys.path. Not only that, we can do more. If we keep sys.path per Evaluator instance, then we can ask Jedi "what kind of modules I'd have if I have this set of
sys.path
?" without running Jedi in another Python process. This may be useful, for example if you want to have different set of completions when you switch project.(BTW, I am using partially 8 months-old knowledge of Jedi so, sorry if I miss some new features.)
The text was updated successfully, but these errors were encountered: