Skip to content

Build failure: python314Packages.python-lsp-ruff #548631

Closed

Description

@mansaliacom

Nixpkgs version

  • Unstable (26.11)

Steps to reproduce

  1. run nix build -vL nixpkgs\#python314Packages.python-lsp-ruff
  2. observe 2 failing tests

Can Hydra reproduce this build failure?

Yes, Hydra can reproduce this build failure.

Link to Hydra build job

https://hydra.nixos.org/build/340342944

Relevant log output

Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing pypa-build-hook
Using pypaBuildPhase
Sourcing python-runtime-deps-check-hook
Using pythonRuntimeDepsCheckHook
Sourcing pypa-install-hook
Using pypaInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-metadata-check-hook.sh
Using pythonMetadataCheckPhase
Sourcing python-namespaces-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing pytest-check-hook
Using pytestCheckPhase
Running phase: unpackPhase
unpacking source archive /nix/store/z47051iwh297v5l3587844qsyxh3ng63-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file "source/tests/test_ruff_lint.py"
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
Executing pypaBuildPhase
Creating a wheel...
pypa build flags: --no-isolation --outdir dist/ --wheel
* Getting build dependencies for wheel...
/nix/store/fkfl68z8s63y73y66398j7jrzvqdsddp-python3.14-setuptools-83.0.0/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:8ing: `project.license` as a TOML table is deprecated
!!

        ********************************************************************************
        Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options av0).

        By 2027-Feb-18, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  corresp(dist, value, root_dir)
running egg_info
creating python_lsp_ruff.egg-info
writing python_lsp_ruff.egg-info/PKG-INFO
writing dependency_links to python_lsp_ruff.egg-info/dependency_links.txt
writing entry points to python_lsp_ruff.egg-info/entry_points.txt
writing requirements to python_lsp_ruff.egg-info/requires.txt
writing top-level names to python_lsp_ruff.egg-info/top_level.txt
writing manifest file 'python_lsp_ruff.egg-info/SOURCES.txt'
reading manifest file 'python_lsp_ruff.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'python_lsp_ruff.egg-info/SOURCES.txt'
* Building wheel...
/nix/store/fkfl68z8s63y73y66398j7jrzvqdsddp-python3.14-setuptools-83.0.0/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:8ing: `project.license` as a TOML table is deprecated
!!

        ********************************************************************************
        Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options av0).

        By 2027-Feb-18, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!
  corresp(dist, value, root_dir)
running bdist_wheel
running build
running build_py
creating build/lib/pylsp_ruff
copying pylsp_ruff/settings.py -> build/lib/pylsp_ruff
copying pylsp_ruff/plugin.py -> build/lib/pylsp_ruff
copying pylsp_ruff/__init__.py -> build/lib/pylsp_ruff
copying pylsp_ruff/ruff.py -> build/lib/pylsp_ruff
running egg_info
writing python_lsp_ruff.egg-info/PKG-INFO
writing dependency_links to python_lsp_ruff.egg-info/dependency_links.txt
writing entry points to python_lsp_ruff.egg-info/entry_points.txt
writing requirements to python_lsp_ruff.egg-info/requires.txt
writing top-level names to python_lsp_ruff.egg-info/top_level.txt
reading manifest file 'python_lsp_ruff.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'python_lsp_ruff.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/pylsp_ruff
copying build/lib/pylsp_ruff/settings.py -> build/bdist.linux-x86_64/wheel/./pylsp_ruff
copying build/lib/pylsp_ruff/__init__.py -> build/bdist.linux-x86_64/wheel/./pylsp_ruff
copying build/lib/pylsp_ruff/plugin.py -> build/bdist.linux-x86_64/wheel/./pylsp_ruff
copying build/lib/pylsp_ruff/ruff.py -> build/bdist.linux-x86_64/wheel/./pylsp_ruff
running install_egg_info
Copying python_lsp_ruff.egg-info to build/bdist.linux-x86_64/wheel/./python_lsp_ruff-2.3.1-py3.14.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/python_lsp_ruff-2.3.1.dist-info/WHEEL
creating '/build/source/dist/.tmp-xoiahm3j/python_lsp_ruff-2.3.1-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'pylsp_ruff/__init__.py'
adding 'pylsp_ruff/plugin.py'
adding 'pylsp_ruff/ruff.py'
adding 'pylsp_ruff/settings.py'
adding 'python_lsp_ruff-2.3.1.dist-info/licenses/LICENSE'
adding 'python_lsp_ruff-2.3.1.dist-info/METADATA'
adding 'python_lsp_ruff-2.3.1.dist-info/WHEEL'
adding 'python_lsp_ruff-2.3.1.dist-info/entry_points.txt'
adding 'python_lsp_ruff-2.3.1.dist-info/top_level.txt'
adding 'python_lsp_ruff-2.3.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built python_lsp_ruff-2.3.1-py3-none-any.whl
Finished creating a wheel...
/build/source/dist /build/source
Unpacking to: unpacked/python_lsp_ruff-2.3.1...OK
Repacking wheel as ./python_lsp_ruff-2.3.1-py3-none-any.whl...OK
/build/source
Finished executing pypaBuildPhase
Running phase: pythonRuntimeDepsCheckHook
Executing pythonRuntimeDepsCheck
Checking runtime dependencies for python_lsp_ruff-2.3.1-py3-none-any.whl
Finished executing pythonRuntimeDepsCheck
Running phase: installPhase
Executing pypaInstallPhase
Successfully installed python_lsp_ruff-2.3.1-py3-none-any.whl
Finished executing pypaInstallPhase
Running phase: pythonOutputDistPhase
Executing pythonOutputDistPhase
Finished executing pythonOutputDistPhase
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/q6cj947lzaihlk1j94qqfdvlhp3pqydn-python3.14-python-lsp-ruff-2.3.1
checking for references to /build/ in /nix/store/q6cj947lzaihlk1j94qqfdvlhp3pqydn-python3.14-python-lsp-ruff-2.3.1...
patching script interpreter paths in /nix/store/q6cj947lzaihlk1j94qqfdvlhp3pqydn-python3.14-python-lsp-ruff-2.3.1
stripping (with command strip and flags -S -p) in  /nix/store/q6cj947lzaihlk1j94qqfdvlhp3pqydn-python3.14-python-lsp-ruff-2.3.1/lib
shrinking RPATHs of ELF executables and libraries in /nix/store/5gwz8vpk4r3kbra97qibrwbz5bgv4svy-python3.14-python-lsp-ruff-2.3.1-dist
checking for references to /build/ in /nix/store/5gwz8vpk4r3kbra97qibrwbz5bgv4svy-python3.14-python-lsp-ruff-2.3.1-dist...
patching script interpreter paths in /nix/store/5gwz8vpk4r3kbra97qibrwbz5bgv4svy-python3.14-python-lsp-ruff-2.3.1-dist
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
Running phase: installCheckPhase
no Makefile or custom installCheckPhase, doing nothing
Running phase: pythonCatchConflictsPhase
Running phase: pythonRemoveBinBytecodePhase
Running phase: pythonImportsCheckPhase
Executing pythonImportsCheckPhase
Running phase: pythonMetadataCheckPhase
Executing pythonMetadataCheckPhase
Running phase: pytestCheckPhase
Executing pytestCheckPhase
pytest flags: -m pytest
============================= test session starts ==============================
platform linux -- Python 3.14.6, pytest-9.1.1, pluggy-1.6.0
rootdir: /build/source
configfile: pyproject.toml
collected 14 items

tests/test_code_actions.py ....                                          [ 28%]
tests/test_ruff_format.py ...                                            [ 50%]
tests/test_ruff_lint.py .....FF                                          [100%]

=================================== FAILURES ===================================
______________________________ test_ruff_settings ______________________________

workspace = <pylsp.workspace.Workspace object at 0x7ffff48c2eb0>

    def test_ruff_settings(workspace):
        config_str = r"""[tool.ruff]
    ignore = ["F841"]
    exclude = [
        "blah/__init__.py",
        "file_2.py"
    ]
    extend-select = ["D"]
    [tool.ruff.per-file-ignores]
    "test_something.py" = ["F401"]
    """

        doc_str = r"""
    print('hi')
    import os
    def f():
        a = 2
    """

        doc_uri = uris.from_fs_path(os.path.join("/tmp/", "__init__.py"))
        workspace.put_document(doc_uri, doc_str)

        ruff_settings = get_ruff_settings(
            workspace, workspace.get_document(doc_uri), config_str
        )

        # Check that user config is ignored
        empty_keys = [
            "config",
            "line_length",
            "exclude",
            "select",
            "ignore",
            "per_file_ignores",
        ]
        for k in empty_keys:
            assert getattr(ruff_settings, k) is None

        with patch("pylsp_ruff.plugin.Popen") as popen_mock:
            mock_instance = popen_mock.return_value
            mock_instance.communicate.return_value = [bytes(), bytes()]

            doc = workspace.get_document(doc_uri)
            diags = ruff_lint.pylsp_lint(workspace, doc)

        call_args = popen_mock.call_args[0][0]
        assert call_args == [
            "/nix/store/zx9c4rmbf463w2nc4xxynaxcqihl58yi-python3.14-ruff-0.16.1/bin/ruff",


            "check",
            "--quiet",
            "--exit-zero",
            "--output-format=json",
            "--extension=ipynb:python",
            "--no-fix",
            "--force-exclude",
            f"--stdin-filename={os.path.join("/tmp/", '__init__.py')}",
            "--",
            "-",
        ]

        workspace._config.update(
            {
                "plugins": {
                    "ruff": {
                        "extendIgnore": ["D104"],
                        "severities": {"E402": "E", "D": "I", "D1": "H"},
                    }
                }
            }
        )

        diags = ruff_lint.pylsp_lint(workspace, doc)

        _list = []
        for diag in diags:
            _list.append(diag["code"])
        # Assert that ignore, extend-ignore and extend-select is working as intended
>       assert "E402" in _list
E       AssertionError: assert 'E402' in ['I001', 'F401', 'D103']

tests/test_ruff_lint.py:240: AssertionError
------------------------------ Captured log call -------------------------------
ERROR    pylsp_ruff.plugin:plugin.py:571 Ruff returned <MagicMock name='Popen().returncode' id='140737295854832'> != 0
_____________________________ test_notebook_input ______________________________

workspace = <pylsp.workspace.Workspace object at 0x7ffff48c33f0>

    def test_notebook_input(workspace):
        doc_str = r"""
    print('hi')
    import os
    def f():
        a = 2
    """
        # attribute the python code to a notebook file name per jupyterlab-lsp
        doc_uri = uris.from_fs_path(os.path.join("/tmp/", "Untitled.ipynb"))
        workspace.put_document(doc_uri, doc_str)
        doc = workspace.get_document(doc_uri)

        diags = ruff_lint.pylsp_lint(workspace, doc)
        diag_codes = [diag["code"] for diag in diags]
        assert "invalid-syntax" not in diag_codes
>       assert "E402" in diag_codes
E       AssertionError: assert 'E402' in ['D100', 'I001', 'F401', 'D103']

tests/test_ruff_lint.py:294: AssertionError
=========================== short test summary info ============================
FAILED tests/test_ruff_lint.py::test_ruff_settings - AssertionError: assert 'E402' in ['I001', 'F401', 'D103']
FAILED tests/test_ruff_lint.py::test_notebook_input - AssertionError: assert 'E402' in ['D100', 'I001', 'F401', 'D103']
========================= 2 failed, 12 passed in 1.38s =========================

Additional context

Disabling the two offending tests helps, not sure if they are of any significance

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.18.41, NixOS, 26.11 (Zokor), 26.11.20260801.148bab9
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.34.8
  • nixpkgs: /nix/store/j3wl46dgzlyr8bhqh0k24any86x0wn1j-source

Notify maintainers

@linsui


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. anoadragon453 commented on Aug 6, 2026

    @anoadragon453
    Member

    ruff 0.16.0 removed rule E402 from its default rule set. But python-lsp-ruff 2.3.1 has two stale tests (one, two) that still expect E402 by default.

    I've filed a PR upstream to fix the tests: python-lsp/python-lsp-ruff#115

    To workaround the problem in the meantime, one can disable just those two tests with:

    (python-lsp-ruff.overridePythonAttrs (old: {
      # These two tests are temporarily broken upstream: https://github.com/NixOS/nixpkgs/issues/548631
      disabledTests = (old.disabledTests or []) ++ [
        "test_ruff_settings"
        "test_notebook_input"
      ];
    }))
  2. MOIS3Y commented on Aug 24, 2026

    @MOIS3Y
    Contributor

    I can no longer reproduce this issue after updating nixpkgs to
    ffb3c9b700e759be2ef13237c9d8f953b32a1e46.

    I removed my local workaround that disabled test_ruff_settings and
    test_notebook_input, and the full NixOS configuration now builds successfully.

    Current package versions:

    • Python: 3.14.7
    • python-lsp-ruff: 2.3.3
    • Ruff: 0.16.3

    It looks like the issue was resolved by the update from python-lsp-ruff 2.3.1
    to 2.3.3.

    System information
     - system: `"x86_64-linux"`
     - host os: `Linux 6.18.44, NixOS, 26.11 (Zokor), 26.11.20260819.ffb3c9b`
     - multi-user?: `yes`
     - sandbox: `yes`
     - version: `nix-env (Nix) 2.34.8`
     - channels(root): `"nixos"`
     - nixpkgs: `/nix/store/jpnpv93s5ppfb1kbvfp8qa763vfb4fjb-source`
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions