5 ms·
A bit more specifically, looks like pyright was designed to serve as a language server for VS Code. This means being able to incrementally type check incomplet
by bfung 4y ago
A bit more specifically, looks like pyright was designed to serve as a language server for VS Code.
This means being able to incrementally type check incomplete code blocks and to also infer & suggest types, where mypy is too slow and/or just doesn’t support those features.
- mananaysiempre 4y agoPyright was designed by Microsoft to serve as the core of a proprietary[1], DRM-locked[2,3] Python language server, yes. [1] https://github.com/microsoft/pylance-release/issues/4 https://github.com/microsoft/pylance-release/issues/4 [2] https://github.com/microsoft/pylance-release/issues/746 https://github.com/microsoft/pylance-release/issues/746 [3] https://parsiya.net/blog/2021-12-20-rce-in-visual-studio-codes-remote-wsl-for-fun-and-negative-profit/#your-editor-has-drm https://parsiya.net/blog/2021-12-20-rce-in-visual-studio-cod...
- satvikpendem 4y agoYou don't have to use Pylance though, just use Pyright itself. While it's a shame that Pylance isn't open source, I won't fault anyone for not doing so, that's their choice, just as I don't open source all of my code either.
- mananaysiempre 4y agoI do fault them, a bit, philosophically, but that’s not even the core of my complaint here. I may not like Microsoft releasing proprietary software, but I hardly feel surprised or cheated when they do. On the other hand, when Microsoft creates an interoperability standard to solve the proliferation of wheel-inventing in IDEs, actively promotes it as such, creates and supports an open-source implementation of it for Python as part of said promotion, then abandons[1] said implementation in favour of a proprietary one that deliberately speaks the interoperability protocol in a slightly non-interoperable way, then yes, I do feel like I’ve been conned, and maybe I should stop treating Microsoft’s open-source efforts seriously even if they’re good software at the present moment. (Whether my level of cynicism regarding Microsoft should have been high enough that I wouldn’t have been surprised, I’m not sure.) [1] https://github.com/microsoft/python-language-server/issues/2096 https://github.com/microsoft/python-language-server/issues/2...
- satvikpendem 4y agoWell, others are free to make their own language servers if they don't like the current implementations, just as we do with other proprietary software, ie GIMP vs Photoshop.
- mananaysiempre 4y agoAgain, “Microsoft creates proprietary software” (which is what your comment is responding to) is no news; “Microsoft starts interoperable ecosystem, gets everyone on board, then deliberately goes against the ecosystem’s interests” (which is incidentally accomplished by creating proprietary software) is my problem. Authors of other language servers deliberately chose to put up with Microsoft’s legacy-induced craziness in the protocol (positions in UTF-8-encoded strings specified as UTF-16 code unit counts, etc.) due to Microsoft’s promise of an interoperable ecosystem; then Microsoft reneged on that. I’d have much less of a problem, for example, if I could use a proprietary Pylance with VS Codium or Neovim or whatever else I want; I’d have almost no problem if Microsoft also hadn’t published then abandoned an open-source Python language server first. But I can’t, and they did.
- satvikpendem 4y agoI don't see a problem where you do, it seems. Anyone is free to make or not make whatever they want, that they made the ecosystem is enough for me, I've already derived enough benefit from it through interoperability with Neovim as well as VSCode, they simply don't have to make anything else beyond that; even if they initially started and stopped working on a Python language server, that is their prerogative. The ecosystem is no less interoperable just because they made a proprietary language server instead.
- seanw444 4y agoMicrosoft's motto: embrace, extend, extinguish.
- geekraver 4y agoPylance is used in a number of Microsoft products, quite a few of which are not open source, whereas the previous language server was only used in the VS Code and VS Python extensions, which are open source. There's your license difference explanation. As to why the old language server was retired, it had a different architecture which involved reindexing all the code all the time, and the team couldn't make it performant enough; pyright lazily evaluates just what is needed at the point it is needed.
- solarkraft 4y agoThe situation gives me a weird déjà vu.
- amarshall 4y agoMypy has mypyd [1] to run fast live type checking. Things like pylsp-mypy [2] use it automatically by default. [1]: https://mypy.readthedocs.io/en/stable/mypy_daemon.html https://mypy.readthedocs.io/en/stable/mypy_daemon.html [2]: https://github.com/python-lsp/pylsp-mypy https://github.com/python-lsp/pylsp-mypy
- bfung 4y agoCool, didn’t know that!
- shabble 4y agoThe last time I actively looked into it (granted, some months ago), it was somewhat hindered by https://github.com/python/mypy/issues/9309 https://github.com/python/mypy/issues/9309 causing it to re-evaluate sources quite a lot during editing even with mypyd. I just had a quick check and can't obviously see if that has been fixed/worked around in pylsp-mypy, on the off-chance that you might know :)