pyls-mypy
pyls-mypy copied to clipboard
Update plugin to use python-lsp-server instead of python-language-server
Hi,
Given that Palantir removed all the community maintenance for both python-language-server (pyls) and python-jsonrpc-server (pyls_jsonrpc), we decided to create a separate organization that now maintains a community-based fork for the aforementioned packages, which can be found at: https://github.com/python-lsp/python-lsp-server and https://github.com/python-lsp/python-lsp-jsonrpc.
Our recommendation is to migrate this plugin to be compatible with the community server instead of the Palantir one. In order to do so, here is a migration guide that should help:
- The plugin should replace
python-language-server
bypython-lsp-server
on its requirements. - The
pyls
namespace is nowpylsp
, which means that allpyls
imports should be replaced bypylsp
. - The
pyls_*
hookspecs are nowpylsp_*
hookspecs. - The plugin can preserve the
pyls_
prefix on its namespace in order to prevent further administration and release issues that may arise from renaming it.
Feel free to ask any question about the migration process or about the new community organization for the server.
@tomv564 I created a PR to fix this, if you could review, merge and release a python-lsp-server-compatible version of pyls-mypy that would be much appreciated.
@andfoy There is a maintained fork at https://github.com/Richardk2n/mypy-ls.
@Richardk2n Would you accept #52 to make the project work against https://github.com/python-lsp/python-lsp-server? I can open the PR against your repository.
@andfoy I have reviewed mypy-ls and it looks like a minimalistic fork to improve plugin configuration support, but it hasn't had activity since October. It also has issues disabled, which is a red flag for me.
I think best course of action would be to create another fork at python-lsp/pylsp-mypy and release as a new pylsp-mypy package to PyPI. python-lsp-server can then point to this new repository and package as the maintained version of the plugin. If you add me as a maintainer I can handle the necessary changes.
@haplo I'm happy to contribute to that fork.
I would recommend starting from the https://github.com/Richardk2n/mypy-ls fork, as the configuration support is dramatically improved and bring the plugin inline with command-line mypy
invocations.
My personal fork provides support for dmypy
as well as mypy
as well as some misc bugfixes for non-live-mode checking.
If you'd like to @ me in an issue to provide dmypy
support in the fork I can open a PR there.
If you are willing to maintain the new fork, then I'll move it to the organization later today
@haplo I'm happy to contribute to that fork.
I would recommend starting from the https://github.com/Richardk2n/mypy-ls fork, as the configuration support is dramatically improved and bring the plugin inline with command-line
mypy
invocations. My personal fork provides support fordmypy
as well asmypy
as well as some misc bugfixes for non-live-mode checking. If you'd like to @ me in an issue to providedmypy
support in the fork I can open a PR there.
All that sounds good to me, I will bring @Richardk2n improvements for plugin configurability, and will be happy to see your improvements too. Let's get the fork released with python-lsp-server compatibility and then we will keep improving it. Hopefully the community will stop getting fragmented and everybody can contribute to a single upstream project.
BTW I just switched to non-live-mode myself and it's working much better, so I'm looking forward to your bugfixes in that regard. :)
If you are willing to maintain the new fork, then I'll move it to the organization later today
You can sign me up for it, I'm an active user of mypy and the LSP plugin.
@haplo I enabled issues. I did not intend for them to be disabled. I'll happily include any suggestions and would love to see this plugin getting some attention.
@haplo I enabled issues. I did not intend for them to be disabled. I'll happily include any suggestions and would love to see this plugin getting some attention.
Great to hear from you @Richardk2n.
I have no interest in creating yet another fork of the plugin if you are available as a maintainer. If you could merge https://github.com/Richardk2n/mypy-ls/pull/2 and release a new python-lsp-server-compatible version we can ask @andfoy to point to your fork as the recommended mypy plugin.
Please be aware that @andfoy mentioned that python-lsp-server might integrate a mypy plugin in the future, but until then we need to maintain the third-party plugin.
What is the current state of the mypy integration to python-lsp-server ? Is the plan still to create a fork within the python-lsp organization ?
What is the current state of the mypy integration to python-lsp-server ? Is the plan still to create a fork within the python-lsp organization ?
Currently my fork mypy-ls is working with python-lsp-server (as far as i know). And given, that I keep maintaining it there is no plan to fork it on the organization until they decide to integrate mypy support directly into python-lsp-server (as far as i know).
Great ! I just installed it thanks to pip install mypy-ls
.
How is it configurable though ?
When I was using palantir's python-language-server
, I was configuring the mypy plugin in this way: https://github.com/tomv564/pyls-mypy#configuration.
Now that I am using python-lsp-server, am I still able to configure it through the language server config ? As editor, I am using neovim.
It should be configurable as before. However as I never really figured out where the config should be placed (I would be grateful If you could tell me, where and how python-language-server expects its configs) there is a possibility, that I might ignore those passed to the language server. You can try. If it doesn't work place a file with your config formatted as in here in your working directory or a parent of said directory.
I would be grateful for feedback about what works, and how people are using the plugin, as my testing does not cover all use cases.
Hello ! Sorry for having waited before answering. Actually, this fork of the mypy plugin works fine for me with the following configuration section in the language client:
pylsp_mypy = {
enabled = true,
live_mode = false
},
Actually, this fork of the mypy plugin works fine for me with the following configuration section in the language client:
Does it work when you uninstall python-language-server
and install only python-lsp-server
? I would be surprised because the imports in the plugin code are different, I would expect either errors or the plugin not being registered at all.
It seems that I only have python-lsp-server
available right now.
[I] ➜ pip show python-language-server
WARNING: Package(s) not found: python-language-server
~
[I] ➜ pip show python-lsp-server
Name: python-lsp-server
Version: 1.1.0.dev0
Summary: Python Language Server for the Language Server Protocol
Home-page: https://github.com/python-lsp/python-lsp-server
Author: Python Language Server Contributors
Author-email: None
License: UNKNOWN
Location: /home/gaetan/.local/lib/python3.9/site-packages
Requires: jedi, python-lsp-jsonrpc, pluggy, ujson, setuptools
Required-by: mypy-ls
And it works. However, I don't know teh exact way both mypy-ls
and python-lsp-server
interact.
@GaetanLepage OK, that is expected, mypy-ls
(now renamed to pylsp-mypy
) works with python-lsp-server
. pyls-mypy
on the other hand works with python-language-server
, which as the original message in this issue points out, is not maintained anymore. I thought your original comment regarded pyls-mypy
, hence my confusion.
Thank you for this useful clarification !