Spyder with loosen versions of python-lsp-server

"Aeliton G. Silva" <[email protected]>
Newsgroups gmane.linux.debian.devel.python
Message-ID <[email protected]>
Hi Jochen and all,

I appreciate that Julian is quite busy. I'll leave him in CC just in
case he wants to follow up on this and share his thoughts.

As I mentioned on the #debian-python, I had a look at the loosening of
the dependency (to allow python-lsp-server >=1.12.0,<1.14.0). I'm
writing to give further details.

Manual test of the loosened spyder version + pylsp 1.13.2

After building and installing the patched version of spyder (see
attached), I tested it by writing some python code and for what I can
tell pylsp is doing its job normally.

I have to disclose that I have never used spyder before, so it would be
good to have some experienced spyder user to help validating that
everything looks alright. The packages have been uploaded to mentors
[1][2].

About the possible API changes

As our current version of python-lsp-server since trixie is 1.12.0,
I've decided to check spyder's upstream commits that bumped python-lsp-
server up to 1.13.0. We have [3] and [4], both they contain only the
versions bumps and no additional source code changes. This is not
enough as prove that there's not API change in python-lsp-server.

Next I checked the python-lsp-server's upstream history to check all
PRs in between 1.12.2 and 1.13.0 [5], where we could expect API
changes. The relevant changes are:
	* 650 touches signatures but just the type annotation styles,
no public API changes
	* 645 contains public API additions
	* 631 exposes new configurations, but no other public API
change
	* All the remaining PRs contains no API changes: 656, 646,
641, 639, 633 and 628

The full list of merged PRs for 1.13.0 can be checked in [6].

About spyder-unittest + patched spyder + pyslp 1.13.2

tchet, on #debian-python, pointed out that spyder-unittest should work
with both versions. I got the debian sources and run the tests, got 1
failure against the patched versions (see logs attached). I uninstalled
them (both pylsp and {python3-}spyder) and installed the versions from
the official repositories. The tests re-run got exactly the same
failure. I consider this test failure not related to the upgrade of
python-lsp-server.

Conclusion

Based on the information above I believe it is viable to ship the patch
to spyder loosening the versions for python-lsp-server.

Please let me know your thoughts about this.

1. https://mentors.debian.net/package/spyder/
2. https://mentors.debian.net/package/python-lsp-server/
3. https://github.com/spyder-ide/spyder/commit/3a670e0e32
4. https://github.com/spyder-ide/spyder/commit/77468c7a7d
5.
https://github.com/python-lsp/python-lsp-server/compare/v1.12.2...v1.13.0
6. https://github.com/python-lsp/python-lsp-server/commit/8c96441745876a104554450d779a3d01ac4e76dd
0001-Soften-python-lsp-server-version.patch (text/x-patch, 4 KB)
From 9b7e68847ca24e24dc7b5ea9e71b7d017869cf7e Mon Sep 17 00:00:00 2001
From: Aeliton Silva <[email protected]>
Date: Mon, 24 Nov 2025 15:15:40 -0300
Subject: [PATCH] Soften python-lsp-server version

---
 debian/control                                |  4 +-
 ...009-Soften-python-lsp-server-version.patch | 72 +++++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 debian/patches/0009-Soften-python-lsp-server-version.patch

diff --git a/debian/control b/debian/control
index fba7382..2a6eee9 100644
--- a/debian/control
+++ b/debian/control
@@ -39,7 +39,7 @@ Build-Depends: debhelper-compat (= 13),
                python3-pygments,
                python3-pylint-venv (>= 3.0.2),
                python3-pyls-spyder (>= 0.4.0),
-               python3-pylsp (<< 1.13~),
+               python3-pylsp (<< 1.14~),
                python3-pylsp (>= 1.12.0),
                python3-pylsp-black (<< 3.0.0~),
                python3-pylsp-black (>= 2.0.0),
@@ -113,7 +113,7 @@ Depends: fzf,
          python3-parso (>= 0.7.0),
          python3-pycodestyle,
          python3-pydocstyle (>= 6.2.3),
-         python3-pylsp (<< 1.13~),
+         python3-pylsp (<< 1.14~),
          python3-pylsp (>= 1.12.0),
          python3-pylsp-black (<< 3.0.0~),
          python3-pylsp-black (>= 2.0.0),
diff --git a/debian/patches/0009-Soften-python-lsp-server-version.patch b/debian/patches/0009-Soften-python-lsp-server-version.patch
new file mode 100644
index 0000000..6f747b5
--- /dev/null
+++ b/debian/patches/0009-Soften-python-lsp-server-version.patch
@@ -0,0 +1,72 @@
+From: Aeliton Silva <[email protected]>
+Date: Mon, 24 Nov 2025 15:14:38 -0300
+Subject: Soften python-lsp-server version
+
+---
+ binder/environment.yml | 2 +-
+ requirements/main.yml  | 2 +-
+ setup.py               | 4 ++--
+ spyder/dependencies.py | 2 +-
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/binder/environment.yml b/binder/environment.yml
+index 9978364..9ace09e 100644
+--- a/binder/environment.yml
++++ b/binder/environment.yml
+@@ -38,7 +38,7 @@ dependencies:
+ - pyqt >=5.15,<5.16
+ - pyqtwebengine >=5.15,<5.16
+ - python-lsp-black >=2.0.0,<3.0.0
+-- python-lsp-server >=1.12.0,<1.13.0
++- python-lsp-server >=1.12.0,<1.14.0
+ - pyuca >=1.2
+ - pyxdg >=0.26
+ - pyzmq >=24.0.0
+diff --git a/requirements/main.yml b/requirements/main.yml
+index d5d0d42..0e6ca69 100644
+--- a/requirements/main.yml
++++ b/requirements/main.yml
+@@ -35,7 +35,7 @@ dependencies:
+   - pyqt >=5.15,<5.16
+   - pyqtwebengine >=5.15,<5.16
+   - python-lsp-black >=2.0.0,<3.0.0
+-  - python-lsp-server >=1.12.0,<1.13.0
++  - python-lsp-server >=1.12.0,<1.14.0
+   - pyuca >=1.2
+   - pyzmq >=24.0.0
+   - qdarkstyle >=3.2.0,<3.3.0
+diff --git a/setup.py b/setup.py
+index cc85242..85f0ef2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -294,7 +294,7 @@ install_requires += [
+     'pylint-venv>=3.0.2',
+     'pyls-spyder>=0.4.0',
+     'python-lsp-black>=2.0.0,<3.0.0',
+-    'python-lsp-server[all]>=1.12.0,<1.13.0',
++    'python-lsp-server[all]>=1.12.0,<1.14.0',
+     'pyuca>=1.2',
+     'pyxdg>=0.26;platform_system=="Linux"',
+     'pyzmq>=24.0.0',
+@@ -323,7 +323,7 @@ if 'dev' in __version__:
+     install_requires = [req for req in install_requires
+                         if req.split(">")[0] not in reqs_to_loosen]
+ 
+-    install_requires.append('python-lsp-server[all]>=1.12.0,<1.14.0')
++    install_requires.append('python-lsp-server[all]>=1.12.0,<1.15.0')
+     install_requires.append('qtconsole>=5.5.1,<5.7.0')
+ 
+ extras_require = {
+diff --git a/spyder/dependencies.py b/spyder/dependencies.py
+index 30820de..56d6b6c 100644
+--- a/spyder/dependencies.py
++++ b/spyder/dependencies.py
+@@ -59,7 +59,7 @@ PYGITHUB_REQVER = '>=2.3.0'
+ PYGMENTS_REQVER = '>=2.0'
+ PYLINT_REQVER = '>=3.1,<4'
+ PYLINT_VENV_REQVER = '>=3.0.2'
+-PYLSP_REQVER = '>=1.12.0,<1.13.0'
++PYLSP_REQVER = '>=1.12.0,<1.14.0'
+ PYLSP_BLACK_REQVER = '>=2.0.0,<3.0.0'
+ PYLS_SPYDER_REQVER = '>=0.4.0'
+ PYUCA_REQVER = '>=1.2'
-- 
2.51.0
spyder-unittest-run.txt (text/plain, 4 KB)
➜  spyder-unittest git:(master) ✗ pytest spyder_unittest/tests
=============================================================================================== test session starts ================================================================================================
platform linux -- Python 3.13.9, pytest-8.4.2, pluggy-1.6.0
PyQt5 5.15.11 -- Qt runtime 5.15.17 -- Qt compiled 5.15.17
rootdir: /home/aeliton/git/debian/spyder-unittest
configfile: pytest.ini
plugins: flaky-3.8.1, qt-4.4.0, typeguard-4.4.4
collected 5 items

spyder_unittest/tests/test_unittestplugin.py .F...                                                                                                                                                           [100%]

===================================================================================================== FAILURES =====================================================================================================
______________________________________________________________________________________________ test_pythonpath_change ______________________________________________________________________________________________

main_window = <spyder.app.mainwindow.MainWindow object at 0x7f75783b47a0>

    def test_pythonpath_change(main_window):
        """
        Test that pythonpath changes in Spyder propagate to UnitTestWidget.
        """
        ppm = main_window.get_plugin(Plugins.PythonpathManager)
        unittest_plugin = main_window.get_plugin(UnitTestPlugin.NAME)

        new_path = '/some/path'
        new_path_dict = OrderedDict([(new_path, True)])
>       ppm.get_container()._save_paths(user_paths=new_path_dict)
E       TypeError: PythonpathContainer._save_paths() got an unexpected keyword argument 'user_paths'

/home/aeliton/git/debian/spyder-unittest/spyder_unittest/tests/test_unittestplugin.py:65: TypeError
----------------------------------------------------------------------------------------------- Captured Qt messages -----------------------------------------------------------------------------------------------
QtWarningMsg: Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created.
QtWarningMsg: Scenegraph already initialized, setBackend() request ignored
================================================================================================= warnings summary =================================================================================================
../../../../../usr/lib/python3/dist-packages/spyder/config/base.py:441
  /usr/lib/python3/dist-packages/spyder/config/base.py:441: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    locale_language = locale.getdefaultlocale()[0]

spyder_unittest/tests/test_unittestplugin.py::test_menu_item
  /usr/lib/python3/dist-packages/jupyter_client/connect.py:22: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================= short test summary info ==============================================================================================
FAILED spyder_unittest/tests/test_unittestplugin.py::test_pythonpath_change - TypeError: PythonpathContainer._save_paths() got an unexpected keyword argument 'user_paths'
===================================================================================== 1 failed, 4 passed, 2 warnings in 45.83s =====================================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.