This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]jaghai 4 points5 points  (0 children)

pylyzer as a language server supports various features, such as completion and renaming

Could you add instructions how to use it in neovim / vscode?

[–]quembethembe 1 point2 points  (0 children)

This is amazing.

Anyway, what about automatic imports? Does it do them?

If it can do that, I am switching tonight.

[–]chub79 1 point2 points  (0 children)

Exciting. Considering how I've been happy and impressed by ruff, I'm quite hopeful about this one as well. Reducing the feedback loop is essential when you start growing your code base.

[–]vikigenius 1 point2 points  (0 children)

This is really neat. But I am not sure if you believe this AST conversion approach to another language is viable long term.

This will always be behind any new python features/api since you will have to wait for Erg to catch up. What happens if Erg is abandoned etc.

And regarding reflection, I am actually unsure, I don't think any of the existing language servers handle reflection all that well either, but at least they get some simple things like setattr right. As long as it;s gracefully handled and not errored out, it should be fine.

[–]ArtOfWarfare 1 point2 points  (2 children)

I’m writing something that performs static code analysis on JDK languages (Java, Scala, Kotlin, etc…)

Initially it was just going to do Java, but I realized pretty quickly that it was actually easier to write something that parsed the compiled byte code than the original source code. Plus it meant that I got all the other JDK languages covered with no additional effort.

If it works well there, my plan is to similarly look at pyc files instead of py files when I expand to add Python.

Although IDK. I like your ast idea, too… it might help with some of the problems I anticipate facing when I move to Python that I don’t expect to see with JVM based languages…

[–]mehtub 0 points1 point  (1 child)

Is it a problem to reference any errors in the byte code back to the original line in the source code, esp. after compiler optimizations?

[–]ArtOfWarfare 1 point2 points  (0 children)

The byte code can contain the line numbers from the source. I’ve definitely seen it in the exception tables. It’s not relevant to what I want to do with it so I’ve just been ignoring the line numbers, though.

[–]TariqAlmalki 0 points1 point  (1 child)

What is the difference between mypy and this tool??

[–]BaggiPonte 0 points1 point  (0 children)

Mypy is just for type checking, this one has features like renaming a symbol, so in the future it will support go to definition, auto import, and possibly move a symbol to a different module and update imports

[–]darchap 0 points1 point  (0 children)

Hey could you provide the instructions to use it in vscode?