Live data from Hacker News

Pylyzer – A fast static code analyzer and language server for Python

github.com

21–27 of 27 posts

Re: Pylyzer – A fast static code analyzer and language server for Python

#21
post #14

Looking through the code, Pylyzer seems to be a thin wrapper around Erg [1]. To typecheck, it converts your Python AST to an Erg AST, then runs its through the Erg typechecker and returns the errors. Faster typechecking for Python is very much needed. But this project seems like it was built in a hackathon -- it is not a true standalone typechecker. [1] https://github.com/erg-lang/erg

It's also made by the top contributor to erg (github user mtshiba), and erg is trying to be a compiled typed python.

If you're already making that then building a type checker wrapper on top of it makes perfect sense.

Re: Pylyzer – A fast static code analyzer and language server for Python

#23
post #13

I'm really excited for this. Yes, pyright is fast enough, 99% of the time. But the install story, requiring npm etc, is a bit of a pain. A rust based version with similar install ease as ruff would be great. Additionally, if it is a lot faster, I think it should unlock more possibilities for eager search to improve the lsp. Quite often the pyright lsp doesn't find auto imports - there's just too much many places to s…

Python LSP Server works great, is easier to install and even offers some optional extensions. https://github.com/python-lsp/python-lsp-server

This unfortunately has `docstring-to-markdown` as one of its dependencies, which is a pain to install behind corporate pip proxies because it's under GPL.

Re: Pylyzer – A fast static code analyzer and language server for Python

#24
post #18

Earlier quoted context omitted.

Pyright requires npm?! Wtf!

It's written by Microsoft in TypeScript.

Which is a very sensible decision given that VSCode is Typescript, and also it means it can run on the web. Also Typescript is a much nicer and faster language than Python.

But it does cause some awkwardness.

Re: Pylyzer – A fast static code analyzer and language server for Python

#25
post #14

Looking through the code, Pylyzer seems to be a thin wrapper around Erg [1]. To typecheck, it converts your Python AST to an Erg AST, then runs its through the Erg typechecker and returns the errors. Faster typechecking for Python is very much needed. But this project seems like it was built in a hackathon -- it is not a true standalone typechecker. [1] https://github.com/erg-lang/erg

I dug into Pylyzer a few weeks back when scoping out alternatives for faster type checkers, as we have a lot of brittle Python code that we are gradually migrating in at $DAYJOB. I got the idea in my head to basically build mypy but in Rust, similar to what Ruff has done. My research agrees with your assessment. While I'm sure it's a lot faster (I think the README implies it's one or two magnitudes faster) it just do…

Did you come across pyre in your search? MIT license and pretty fast.

https://github.com/facebook/pyre-check

Re: Pylyzer – A fast static code analyzer and language server for Python

#26

I'm really excited for this. Yes, pyright is fast enough, 99% of the time. But the install story, requiring npm etc, is a bit of a pain. A rust based version with similar install ease as ruff would be great. Additionally, if it is a lot faster, I think it should unlock more possibilities for eager search to improve the lsp. Quite often the pyright lsp doesn't find auto imports - there's just too much many places to s…

In the interim, check out basedpyright [1]. It's an up-to-date fork of pyright with some improvements, less arbitrary limitations, and does not require npm to install. [1] https://github.com/detachhead/basedpyright

I was thrilled to learn about basedpyright recently. It does a great job of filling in some of the missing parts of pyright that MS deemed a better fit for pylance – which is a vs code exclusive.

Easy to install with pipx.

As with pyright, I’ve noticed `--createstubs` helps against slowness when working in modules that import large untyped packages.

Post reply on HN