Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin crash crashes whole diagnostic #153

Closed
Richardk2n opened this issue Jan 9, 2022 · 6 comments · Fixed by #158
Closed

Plugin crash crashes whole diagnostic #153

Richardk2n opened this issue Jan 9, 2022 · 6 comments · Fixed by #158
Assignees
Milestone

Comments

@Richardk2n
Copy link
Member

While writing pylsp-mypy (and using it life in spyder), I noticed, that whenever one plugin crashes, the whole diagnostic stops. When the issue is in the startup code spyder tells me the server is starting indefinitely. The reason behind that is likely, that there are no guards to catch crashes. Please correct me if this is wrong. For the plugins you maintain this is somewhat reasonable, but with 3rd party plugins, I think some error handling would be nice.

Please treat this as a feature request rather than a bug.

@ccordoba12
Copy link
Member

Hey @Richardk2n, thanks for reporting. Could you post a traceback when that happens? I don't know how easy it could be to catch those errors and log them, but we could give it a try.

@ccordoba12
Copy link
Member

While writing pylsp-mypy (and using it life in spyder)

By the way, what do you think about migrating your plugin to our organization? In the future we'd like to officially integrate it with Spyder, so it'd be nice having it here.

Also, if you have some free time, you could give us a hand to add MyPy linting to Spyder for version 6 (we could guide you on how to do that).

@Richardk2n
Copy link
Member Author

I added an assert 0 == 1 to simulate an error. If an error occurs in the startup code (pylsp_settings), spyder informs we (with the internal issue accured popup) about an issue with the following traceback:

  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 116, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_jsonrpc/endpoint.py", line 185, in _handle_request
    handler_result = handler(params)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 210, in m_initialize
    self.config = config.Config(rootUri, initializationOptions or {},
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/config/config.py", line 64, in __init__
    for plugin_conf in self._pm.hook.pylsp_settings(config=self):
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 304, in pylsp_settings
    configuration = init(config._root_path)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 323, in init
    assert 0 == 1

AssertionError

Spyder hands at "LSP Python: starting" and no linting ever happens.

When the issue is in the actual lint code spyder does not notice (at least it does not report an error)
~/.config/spyder-py3/lsp_logs/server_python_*.log contains the following:

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
Exception in thread Thread-7:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return func(*args, **kwargs)
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    self.run()
    result = func()
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
    self.function(*self.args, **self.kwargs)
    self.function(*self.args, **self.kwargs)
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return func(*args, **kwargs)
    return func(*args, **kwargs)
    return outcome.get_result()
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
    result = func()
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
    assert 0 == 1
    return outcome.get_result()
    raise ex[1].with_traceback(ex[2])
AssertionError
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    raise ex[1].with_traceback(ex[2])
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    res = hook_impl.function(*args)
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    return outcome.get_result()
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    assert 0 == 1
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
AssertionError
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    result = func()
    result = func()
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    return outcome.get_result()
    return outcome.get_result()
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    assert 0 == 1
    raise ex[1].with_traceback(ex[2])
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
AssertionError
    res = hook_impl.function(*args)
    assert 0 == 1
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
AssertionError
    assert 0 == 1
AssertionError
Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    assert 0 == 1
AssertionError
Exception in thread Thread-20:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    assert 0 == 1
AssertionError
Exception in thread Thread-19:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
Exception in thread Thread-21:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
Exception in thread Thread-13:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
    self.run()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    self.function(*self.args, **self.kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
    return func(*args, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
Exception in thread Thread-18:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    return func(*args, **kwargs)
    self.run()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
  File "/usr/lib/python3.10/threading.py", line 1371, in run
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
    self.function(*self.args, **self.kwargs)
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/_utils.py", line 33, in run
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
    return func(*args, **kwargs)
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 299, in lint
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 156, in _hook
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
    raise ex[1].with_traceback(ex[2])
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    return outcome.get_result()
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    result = func()
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 327, in traced_hookexec
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    raise ex[1].with_traceback(ex[2])
    raise ex[1].with_traceback(ex[2])
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    result = func()
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    assert 0 == 1
    raise ex[1].with_traceback(ex[2])
    raise ex[1].with_traceback(ex[2])
    raise ex[1].with_traceback(ex[2])
AssertionError
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 33, in from_call
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    result = func()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_manager.py", line 324, in <lambda>
    res = hook_impl.function(*args)
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
    assert 0 == 1
AssertionError
    assert 0 == 1
AssertionError
    return outcome.get_result()
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/richard/.myVenv/lib/python3.10/site-packages/pylsp_mypy/plugin.py", line 137, in pylsp_lint
    assert 0 == 1
AssertionError

Also no linting accurs, but spyder is totaly oblivious to it.

Looking at those tracebacks and reading a little into the files, I guess, that it could be somewhat solved within pylsp, but the abstraction makes it difficult to handle without modifying Pluggy.

@Richardk2n
Copy link
Member Author

While writing pylsp-mypy (and using it life in spyder)

By the way, what do you think about migrating your plugin to our organization? In the future we'd like to officially integrate it with Spyder, so it'd be nice having it here.

Also, if you have some free time, you could give us a hand to add MyPy linting to Spyder for version 6 (we could guide you on how to do that).

Moving it to the organization would be something I would be willing to do, given that I can still work on it and given that I have a say in major changes. Furthermore, it would be nice if you could help with correct handling of the license, because I am not very sure if the current state of my license is correct. As long as I get credit, it does not matter too much for me, where I do the work.

I do not really have a lot of free time, but I would really like to see it added to spyder in the long term. I would gladly invest some evenings and most weekends into that.

@ccordoba12
Copy link
Member

I added an assert 0 == 1 to simulate an error

Ok, it seems we need to catch any error when loading plugins, and just log them, so the server doesn't crash. I'll try to take a look at for our next version (1.4.0).

@ccordoba12 ccordoba12 self-assigned this Jan 9, 2022
@ccordoba12 ccordoba12 added this to the v1.4.0 milestone Jan 9, 2022
@ccordoba12
Copy link
Member

Moving it to the organization would be something I would be willing to do, given that I can still work on it and given that I have a say in major changes

Great! I'll send you an invite and give you the right permissions so you can do the migration. These are the docs about it:

https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository

Furthermore, it would be nice if you could help with correct handling of the license

Sure, we can help you with that. Just open an issue after you migrate the repo and we'll take a look at it.

I do not really have a lot of free time, but I would really like to see it added to spyder in the long term. I would gladly invest some evenings and most weekends into that.

No worries, Spyder 6 will probably be released at the end of the year, or the beginning of the next one, so there's ample time for that. Also, we plan to do developer meetings to start discussing about Spyder development in the coming months, so that'll be a great way for us to tell you how to get started a give you a hand when you're stuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants