Closed gwerbin closed 6 months ago
I'm curious, why are you interested in this specific fact?
What is considered a "path from local directories" from the perspective of Jedi? A practical example would be very much appreciated.
I'm struggling a bit to give you an example, because I'm pretty sure I would miss some things without reading the code properly. I think you're on the right track though. In general Jedi tries to find a "project" if none is provided and that might as well be wrong. So we add sys paths like that current or parent directory depending on a few factors. It's not that complicated, but I'm a bit too lazy to read all of that code now :)
You also have to see it from a practical perspective: Jedi is mostly about good completions, not about 100% correctness. So adding a sys path that might not be correct typically does no harm, but is a very useful addition in some cases.
Search upward from something called inference_state.script_path, looking for init.py files. Is that "script path" the file currently under analysis?
Exactly.
Thanks for the reply! The reason I am interested is because currently all three established Python language servers are built on Jedi. Exploring their source code, it looks like they are all relatively thin wrappers when it comes to environment detection and configuration. When I am using any one of them, it's helpful to understand what is handled automatically by Jedi, and what I need to set up manually. It's also helpful for anyone who might want to work on an application that uses Jedi, even if it's just contributing documentation.
Thanks for your answer. There's also Pyright, just FYI and my upcoming rewrite of Jedi/Mypy in Rust.
I assume your question was answered?
It was, thank you! Should I contribute a doc update for this, or do you expect the behavior to be changed in said upcoming rewrite?
A contribution would probably make sense (if you find good wording for it).
The behavior will not change in the rewrite, because those projects are going to coexist.
The doc for
Project
says:I apologize if I'm just being dense, but what does this actually mean? What is considered a "path from local directories" from the perspective of Jedi? A practical example would be very much appreciated.
I took a look at the source code, but from what I could glean it looks like it does the following:
buildout.cfg
files, for use with the Buildout tool.inference_state.script_path
, looking for__init__.py
files. Is that "script path" the file currently under analysis?