From e16e37ee35f93733bcdcd4bc4968a722838e7838 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 3 Dec 2025 13:38:08 -0500 Subject: [PATCH 1/3] Fix starting the server for Python 3.14 --- pylsp/python_lsp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pylsp/python_lsp.py b/pylsp/python_lsp.py index a2640666..bdc072d4 100644 --- a/pylsp/python_lsp.py +++ b/pylsp/python_lsp.py @@ -4,6 +4,7 @@ import logging import os import socketserver +import sys import threading import uuid from functools import partial @@ -71,9 +72,13 @@ def shutdown_server(check_parent_process, *args): handler_class.__name__ + "Handler", (_StreamHandlerWrapper,), { - "DELEGATE_CLASS": partial( - handler_class, check_parent_process=check_parent_process - ), + # We need to wrap this in staticmethod due to the changes to + # functools.partial in Python 3.14+ + "DELEGATE_CLASS": staticmethod( + partial(handler_class, check_parent_process=check_parent_process) + ) + if sys.version_info >= (3, 14) + else partial(handler_class, check_parent_process=check_parent_process), "SHUTDOWN_CALL": partial(shutdown_server, check_parent_process), }, ) From 43145612418f65b1baeaf18931a58a90f8c6254c Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 3 Dec 2025 14:26:43 -0500 Subject: [PATCH 2/3] Start testing in Python 3.14 --- .github/workflows/test-linux.yml | 2 +- .github/workflows/test-mac.yml | 2 +- .github/workflows/test-win.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 7a7f2f6e..543744a6 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.11', '3.10', '3.9'] + PYTHON_VERSION: ['3.14', '3.13', '3.12', '3.11', '3.10', '3.9'] timeout-minutes: 10 steps: - uses: actions/cache@v4 diff --git a/.github/workflows/test-mac.yml b/.github/workflows/test-mac.yml index a92c82a8..7b06ad26 100644 --- a/.github/workflows/test-mac.yml +++ b/.github/workflows/test-mac.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.11', '3.10', '3.9'] + PYTHON_VERSION: ['3.14', '3.12', '3.9'] timeout-minutes: 10 steps: - uses: actions/cache@v4 diff --git a/.github/workflows/test-win.yml b/.github/workflows/test-win.yml index 8ecd3429..fa71c5ce 100644 --- a/.github/workflows/test-win.yml +++ b/.github/workflows/test-win.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - PYTHON_VERSION: ['3.11', '3.10', '3.9'] + PYTHON_VERSION: ['3.14', '3.12', '3.9'] timeout-minutes: 10 steps: - uses: actions/cache@v4 From 0b66b997039e31b53a72e462d44595c17a1db511 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 3 Dec 2025 14:38:58 -0500 Subject: [PATCH 3/3] Fix test on Windows with Python 3.14 --- test/plugins/test_flake8_lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py index d8199d63..ad1dc4ff 100644 --- a/test/plugins/test_flake8_lint.py +++ b/test/plugins/test_flake8_lint.py @@ -126,7 +126,7 @@ def test_flake8_config_param(workspace) -> None: with patch("pylsp.plugins.flake8_lint.Popen") as popen_mock: mock_instance = popen_mock.return_value mock_instance.communicate.return_value = [b"", b""] - flake8_conf = "/tmp/some.cfg" + flake8_conf = "C:\\some.cfg" if os.name == "nt" else "/tmp/some.cfg" workspace._config.update({"plugins": {"flake8": {"config": flake8_conf}}}) _name, doc = temp_document(DOC, workspace) flake8_lint.pylsp_lint(workspace, doc)