Skip to content

Python#

Server#

For more information about the LSP server, check pylsp.

Installation#

pip install 'python-lsp-server[all]'

Debugger: Yes#

Available configurations#

lsp-clients-pylsp-library-directories#

Type: (repeat string)

Default: (/usr/)

List of directories which will be considered to be libraries.


lsp-pylsp-configuration-sources#

Type: lsp-string-vector

Default: [flake8]

List of configuration sources to use.


lsp-pylsp-plugins-autopep8-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-black-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-flake8-config#

Type: string

Default: nil

A path to a config file that will be the only config file read and used. This will cause Flake8 to ignore all other config files that exist.

NOTE: other parameters as lsp-pylsp-plugins-flake8-max-line-length take precedence over parameters referenced in config.


lsp-pylsp-plugins-flake8-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-flake8-exclude#

Type: lsp-string-vector

Default: nil

List of glob patterns to exclude from checks.


lsp-pylsp-plugins-flake8-filename#

Type: lsp-string-vector

Default: nil

List of glob patterns to include for checks.


lsp-pylsp-plugins-flake8-hang-closing#

Type: boolean

Default: nil

Toggle whether pycodestyle should enforce matching the indentation of the opening bracket`s line. When you specify this, it will prefer that you hang the closing bracket rather than match the indentation.


lsp-pylsp-plugins-flake8-ignore#

Type: lsp-string-vector

Default: nil

A list of codes to ignore.


lsp-pylsp-plugins-flake8-max-line-length#

Type: integer

Default: nil

Set the maximum length that any line (with some exceptions) may be. Exceptions include lines that are either strings or comments which are entirely URLs.


lsp-pylsp-plugins-flake8-select#

Type: lsp-string-vector

Default: nil

Specify the list of error codes you wish Flake8 to report. Similarly to lsp-pylsp-plugins-flake8-ignore. You can specify a portion of an error code to get all that start with that string. For example, you can use E, E4, E43, and E431


lsp-pylsp-plugins-isort-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-completion-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-completion-fuzzy#

Type: boolean

Default: nil

If enabled, uses fuzzy completion in jedi. Requires pylsp >= 0.32.0 Can hit performance, as well as lsp-mode implements its own fuzzy search on completion items.


lsp-pylsp-plugins-jedi-completion-include-class-objects#

Type: boolean

Default: t

If enabled, adds class objects to completion in order to avoid snippet with init args.

Has no effect if lsp-pylsp-plugins-jedi-completion-include-params is disabled. Requires pylsp >= 0.33.0


lsp-pylsp-plugins-jedi-completion-include-params#

Type: boolean

Default: t

Auto-completes methods and classes with tabstops for each parameter.


lsp-pylsp-plugins-jedi-definition-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-definition-follow-builtin-imports#

Type: boolean

Default: t

If follow_imports is True will decide if it follow builtin imports.


lsp-pylsp-plugins-jedi-definition-follow-imports#

Type: boolean

Default: t

The goto call will follow imports.


lsp-pylsp-plugins-jedi-environment#

Type: string

Default: nil

Specify the environment that jedi runs on where /bin/python should be the python executable. This option will be prioritized over lsp-pylsp-plugins-jedi-use-pyenv-environment.


lsp-pylsp-plugins-jedi-hover-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-references-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-signature-help-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-symbols-all-scopes#

Type: boolean

Default: t

If True lists the names of all scopes instead of only the module namespace.


lsp-pylsp-plugins-jedi-symbols-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-jedi-use-pyenv-environment#

Type: boolean

Default: nil

If enabled, pass the environment got by pyenv to jedi


lsp-pylsp-plugins-mccabe-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-mccabe-threshold#

Type: number

Default: 15

The minimum threshold that triggers warnings about cyclomatic complexity.


lsp-pylsp-plugins-mypy-config-sub-paths#

Type: lsp-string-vector

Default: nil

Sub paths under which the mypy configuration file may be found.

For each directory searched for the mypy config file, this also searches the sub paths specified here.


lsp-pylsp-plugins-mypy-dmypy#

Type: boolean

Default: nil

If non-nil, use "dmypy run" rather than mypy.

This uses the dmypy daemon and may dramatically improve the responsiveness of the pylsp server, however this currently does not work in live_mode. Enabling this disables live_mode, even for conflicting configs.


lsp-pylsp-plugins-mypy-dmypy-status-file#

Type: string

Default: .dmypy.json

The status file dmypy should use.

This modifies the --status-file option passed to dmypy given dmypy is active.


lsp-pylsp-plugins-mypy-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-mypy-exclude#

Type: lsp-string-vector

Default: nil

A list of regular expressions which should be ignored.

The mypy runner wil not be invoked when a document path is matched by one of the expressions. Note that this differs from the exclude directive of a mypy config which is only used for recursively discovering files when mypy is invoked on a whole directory. For both windows or unix platforms you should use forward slashes (/) to indicate paths.


lsp-pylsp-plugins-mypy-live-mode#

Type: boolean

Default: t

If non-nil, type checking is provided as you type.

This writes to a tempfile every time a check is done. Turning off live_mode means you must save your changes for mypy diagnostics to update correctly.


lsp-pylsp-plugins-mypy-overrides#

Type: (vector (choice string boolean))

Default: [t]

A list of alternate or supplemental command-line options.

This modifies the options passed to mypy or the mypy-specific ones passed to dmypy run. When present, the special boolean member True is replaced with the command-line options that would`ve been passed had overrides not been specified. Later options take precedence, which allows for replacing or negating individual default options (see mypy.main:process_options and mypy --help | grep inverse).


lsp-pylsp-plugins-mypy-report-progress#

Type: boolean

Default: nil

If non-nil, report basic progress to the LSP client.

With this option, pylsp-mypy will report when mypy is running, given your editor supports LSP progress reporting. For small files this might produce annoying flashing, especially in with live_mode. For large projects, enabling this can be helpful to assure yourself whether mypy is still running.


lsp-pylsp-plugins-mypy-strict#

Type: boolean

Default: nil

If non-nil, enable the strict option of mypy.

This option often is too strict to be useful.


lsp-pylsp-plugins-preload-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-preload-modules#

Type: lsp-string-vector

Default: nil

List of modules to import on startup


lsp-pylsp-plugins-pycodestyle-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-pycodestyle-exclude#

Type: lsp-string-vector

Default: nil

Exclude files or directories which match these patterns.


lsp-pylsp-plugins-pycodestyle-filename#

Type: lsp-string-vector

Default: nil

When parsing directories, only check filenames matching these patterns.


lsp-pylsp-plugins-pycodestyle-hang-closing#

Type: boolean

Default: nil

Hang closing bracket instead of matching indentation of opening bracket`s line.


lsp-pylsp-plugins-pycodestyle-ignore#

Type: lsp-string-vector

Default: nil

Ignore errors and warnings


lsp-pylsp-plugins-pycodestyle-max-line-length#

Type: number

Default: nil

Set maximum allowed line length.


lsp-pylsp-plugins-pycodestyle-select#

Type: lsp-string-vector

Default: nil

Select errors and warnings


lsp-pylsp-plugins-pydocstyle-add-ignore#

Type: lsp-string-vector

Default: nil

Ignore errors and warnings in addition to the specified convention.


lsp-pylsp-plugins-pydocstyle-add-select#

Type: lsp-string-vector

Default: nil

Select errors and warnings in addition to the specified convention.


lsp-pylsp-plugins-pydocstyle-convention#

Type: (choice (:tag pep257 numpy))

Default: nil

Choose the basic list of checked errors by specifying an existing convention.


lsp-pylsp-plugins-pydocstyle-enabled#

Type: boolean

Default: t

Enable or disable the plugin.


lsp-pylsp-plugins-pydocstyle-ignore#

Type: lsp-string-vector

Default: nil

Ignore errors and warnings


lsp-pylsp-plugins-pydocstyle-match#

Type: string

Default: (?!test_).*\.py

Check only files that exactly match the given regular expression; default is to match files that dont start withtest_but end with.py`.


lsp-pylsp-plugins-pydocstyle-match-dir#

Type: string

Default: [^\.].*

Search only dirs that exactly match the given regular expression; default is to match dirs which do not begin with a dot.


lsp-pylsp-plugins-pydocstyle-select#

Type: lsp-string-vector

Default: nil

Select errors and warnings


lsp-pylsp-plugins-pyflakes-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-pylint-args#

Type: lsp-string-vector

Default: []

Arguments, passed to pylint


lsp-pylsp-plugins-pylint-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-rope-autoimport-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-rope-autoimport-memory#

Type: boolean

Default: nil

Make the autoimport database memory only.

Drastically increases startup time.


lsp-pylsp-plugins-rope-completion-eager#

Type: boolean

Default: nil

Resolve documentation and detail eagerly.


lsp-pylsp-plugins-rope-completion-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-ruff-config#

Type: file

Default: nil

Custom config for ruff to use.


lsp-pylsp-plugins-ruff-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-plugins-ruff-exclude#

Type: lsp-string-vector

Default: nil

Files to be excluded by ruff checking.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-executable#

Type: file

Default: nil

Custom path to ruff.


lsp-pylsp-plugins-ruff-extend-ignore#

Type: lsp-string-vector

Default: nil

Rules that are additionally ignored by ruff.


lsp-pylsp-plugins-ruff-extend-select#

Type: lsp-string-vector

Default: nil

Rules that are additionally used by ruff.


lsp-pylsp-plugins-ruff-format#

Type: lsp-string-vector

Default: nil

Rules that should be fixed when running textDocument/formatting.

Note each rule must additionally be marked as fixable by ruff.


lsp-pylsp-plugins-ruff-ignore#

Type: lsp-string-vector

Default: nil

Rules to be ignored by ruff.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-line-length#

Type: integer

Default: 88

Line length to pass to ruff checking and formatting.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-per-file-ignores#

Type: (alist :key-type (lsp-string-vector :tag files) :value-type (string :tag rule))

Default: nil

Rules that should be ignored for specific files.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-preview#

Type: boolean

Default: nil

Whether to enable the preview style linting and formatting.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-select#

Type: lsp-string-vector

Default: nil

Rules to be enabled by ruff.

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-severities#

Type: (alist :key-type (lsp-string-vector :tag rules) :value-type (string :tag severity))

Default: nil

Optional table of rules where a custom severity is desired.


lsp-pylsp-plugins-ruff-target-version#

Type: string

Default: nil

The minimum python version to target (applies for both linting and formatting).

Note this variable will be ignored when a when a pyproject.toml or ruff.toml is present.


lsp-pylsp-plugins-ruff-unsafe-fixes#

Type: boolean

Default: nil

Whether or not to offer unsafe fixes as code actions.

Note this is ignored with the "Fix All" action.


lsp-pylsp-plugins-yapf-enabled#

Type: boolean

Default: nil

Enable or disable the plugin.


lsp-pylsp-rename-backend#

Type: (choice (const :tag jedi jedi) (const :tag rope rope))

Default: jedi

Choose renaming backend.

Jedi is preferred but only works for python >= 3.6 and pylsp >= 0.32.0 Beware that Jedi is lazy and doesn`t scan the whole project. So it will rename only references it can find.


lsp-pylsp-rope-extension-modules#

Type: string

Default: nil

Builtin and c-extension modules that are allowed to be imported and inspected by rope.


lsp-pylsp-rope-rope-folder#

Type: lsp-string-vector

Default: nil

The name of the folder in which rope stores project configurations and data. Pass nil for not using such a folder at all.


lsp-pylsp-server-command#

Type: (repeat string)

Default: (pylsp)

Command to start pylsp.



Last update: April 22, 2024