No diagnostics when upgrading from python-lsp-ruff 1.2.0
robmoss opened this issue · 2 comments
I've been using python-lsp-server 1.7.x and python-lsp-ruff 1.2.0 with Emacs 29 and eglot since January or thereabouts, and it's been a great experience. I recently tried upgrading to newer versions of python-lsp-ruff, but with all newer versions (1.3.0, 1.4.0, and 1.5.0) I no longer receive any diagnostics. For example, I've tested the following:
def hello():
print('Hello')
print('World')for which I get a SyntaxError (E999) diagnostic on line 3 with python-lsp-ruff 1.2.0, but no diagnostics for newer versions. I've been trying to find out the underlying cause but simply can't figure it out. I experience the same behaviour whether I use older or newer versions of ruff, and older or newer versions of eglot. As far as I can tell, this appears to be due a change in python-lsp-ruff >= 1.3.0, rather than in python-lsp-server, ruff, or eglot.
Do you have any idea what might be causing this, or what information I can provide to help figure this out?
I am unfamiliar with eglot, but can you change the cmd that calls pylsp and add additional arguments to provide logs? The command should look like this:
<path_to_pylsp> -vvv --log-file /tmp/lsp.log
Looking at the polyglot logs might also help here. For starters though, just post the LSP logs when you have them (you can also mail them to me if you don't want them to be public)
Thanks, this is really helpful, I had no idea how to view these logging messages. When I upgrade to python-lsp-ruff 1.5.1 I can see early in the log:
INFO - pylsp.config.config - Failed to load pylsp entry point 'ruff': No module named 'attrs'
Oh, this is weird. According to pip I have attrs 21.2.0 installed as part of my system's Python 3 installation (Ubuntu 22.04, python3-attr package). That version is old enough that it can only be imported with import attr, but not import attrs.
If I upgrade to attrs 23.1.0 then everything works again!
According to pipdeptree the dependency on attrs comes from lsprotocol. The newest version of lsprotocol (2023.0.0a1) has no version bound on its attrs dependency, but they've since committed a fix so I guess it will be resolved in the next lsprotocol release.
Thanks again for helping me to figure this out. It was doing my head in!