Configuring python-lsp for linting and everything

Hey everyone!

I’ve decided to start using Neovim. I learned a lot of things already and there is this little step restraining me from using it daily : I can’t configure my LSP.

I don’t want to use Mason, I want to configure it myself, (I’m using nvim-lspconfig because I’m not THAT crazy).

Before asking my question, here is the part of my config related to my pylsp :

-- Python LSP

vim.lsp.config('pylsp', {
    settings = {
        pylsp = {
            cmd = {
                'uv',
                'run',
                '--with',
                'python-lsp-server,python-lsp-isort,pylsp-rope,python-lsp-ruff,pylsp-mypy,pyls-memestra',
                'pylsp'
            },
            configurationSources = { "flake8" },
            plugins = {
                -- Disable default linter
                pyflakes = {
                    enabled = false,
                },
                pycodestyle = {
                    enabled = false,
                },
                mccabe = {
                    enabled = false,
                },
                -- Plugins configuration
                flake8 = {
                    enabled = true,
                },
                isort = {
                    enabled = true,
                },
                jedi_completion = {
                    enabled = true,
                    fuzzy = true
                },
                ["pyls-memestra"] = {
                    enabled = true,
                    recursive = true
                },
                rope_autoimport = {
                    enabled = true
                },
            }
        }
    }
})

vim.lsp.enable('pylsp')

I get several warnings, so it seems to work : I have messages when I have an usused import, when I redefine a function… the auto import is working, if I mark a function as @deprecated and try to use it, I have a message.

What I do not have though :

  • When I don’t leave enough space, I don’t have the message “Expected 2 blank lines, got 0”, for example
  • I don’t know if I can have warning about deprecated functions from the standard library (for example datetime.utcnow()). Currently if I use a deprecated function from standard library, I don’t have any warnings
  • I don’t understand how imports are supposed to be sorted automatically, when I import os after import yaml, import os is not moved above

What is wrong with my configuation? What should I read to understand and debug my issues and the incoming one?

Thanks a lot!