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

Docs: Static analysis library capabilities #1269

Closed
fkromer opened this issue Dec 26, 2018 · 3 comments
Closed

Docs: Static analysis library capabilities #1269

fkromer opened this issue Dec 26, 2018 · 3 comments

Comments

@fkromer
Copy link

fkromer commented Dec 26, 2018

It understands Python on a deeper level than all other static analysis frameworks for Python. [jedi.readthedocs.org]

Would be great to have more info about static analysis library capabilities to allow comparing jedi with pylint (plugin Interface), astroid, ast, etc.

@davidhalter
Copy link
Owner

I actually removed that sentence a few days ago. It felt like a strange sentence, for a couple of reasons:

  1. It's arrogant.
  2. I haven't really compared the solutions in quite some time.

But since we're here already, I can give you some background that we might eventually document somewhere.

There are 4 solutions on the market that offer support for your IDE:

The community driven solutions Jedi/Astroid have very different goals for type inference. Astroid tries to analyze entire files and therefore needs to be really fast and therefore sometimes imprecise. This is what Jedi is lacking, it cannot analyze entire files, it's way to slow for that. Not that Jedi is bad software, it just tries really hard to find the correct types. So I would still argue that Jedi understands Python on a deeper level than astroid, but that just comes from the different use case. I haven't really used astroid, though.

PyCharm is clearly the best all-round solution, but they still don't follow decorators and also sometimes make other type inference mistakes. They are really good at working with an index (See #1059). They have in general a pretty solid solution, that PTVS probably tries to imitate. Jedi again is probably still more precise, but Jedi doesn't have all the features: No linting, no refactoring, etc.

For goto/completions, I still think Jedi is probably the best solution, but the other solutions don't just focus on that.

There are 4 static type checkers (using mostly typeshed and annotations):

Knowing the companies behind those solutions, most of these will eventually die and one or two will remain, but in general they serve one purpose: Static type checks. This means that they are working with annotations. If you don't use annotations in your code, these are mostly useless. They are there for specific use cases. So they are not really comparable to the solutions above.

Everything else is either old and unmaintained (e.g. rope), incomplete or proprietary and nobody know about it.

@fkromer
Copy link
Author

fkromer commented Jun 22, 2019

I did not consider the sentence arrogant. However I evaluated different libraries for python-tia and was wondering about how Jedi is different. My use case is analyzing Python source code (primary Python 3, potentially Python 2 as well) and getting the location of classes, class methods, functions, etc. as file line ranges. It seemed like Jedi is not the best fit for this use case. W.r.t. performance ast seems to be the best fit. But your project parso has a more abstract API.

@fkromer fkromer closed this as completed Jun 22, 2019
@davidhalter
Copy link
Owner

Yeah, parso is unfortunately not as fast as ast. That might change in the future, but will take some time.

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

No branches or pull requests

2 participants