Skip to main content

Python Language Server

https://github.com/palantir/python-language-server/workflows/Linux%20tests/badge.svg https://github.com/palantir/python-language-server/workflows/Mac%20tests/badge.svg https://github.com/palantir/python-language-server/workflows/Windows%20tests/badge.svg https://img.shields.io/github/license/palantir/python-language-server.svg

A Python 2.7 and 3.5+ implementation of the Language Server Protocol.

Installation

The base language server requires Jedi to provide Completions, Definitions, Hover, References, Signature Help, and Symbols:

pip install python-language-server

If the respective dependencies are found, the following optional providers will be enabled:

  • Rope for Completions and renaming

  • Pyflakes linter to detect various errors

  • McCabe linter for complexity checking

  • pycodestyle linter for style checking

  • pydocstyle linter for docstring style checking (disabled by default)

  • autopep8 for code formatting

  • YAPF for code formatting (preferred over autopep8)

Optional providers can be installed using the extras syntax. To install YAPF formatting for example:

pip install 'python-language-server[yapf]'

All optional providers can be installed using:

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

If you get an error similar to 'install_requires' must be a string or list of strings then please upgrade setuptools before trying again.

pip install -U setuptools

3rd Party Plugins

Installing these plugins will add extra functionality to the language server:

Please see the above repositories for examples on how to write plugins for the Python Language Server. Please file an issue if you require assistance writing a plugin.

Configuration

Configuration is loaded from zero or more configuration sources. Currently implemented are:

  • pycodestyle: discovered in ~/.config/pycodestyle, setup.cfg, tox.ini and pycodestyle.cfg.

  • flake8: discovered in ~/.config/flake8, setup.cfg, tox.ini and flake8.cfg

The default configuration source is pycodestyle. Change the pyls.configurationSources setting to [‘flake8’] in order to respect flake8 configuration instead.

Overall configuration is computed first from user configuration (in home directory), overridden by configuration passed in by the language client, and then overriden by configuration discovered in the workspace.

To enable pydocstyle for linting docstrings add the following setting in your LSP configuration: ` "pyls.plugins.pydocstyle.enabled": true `

See vscode-client/package.json for the full set of supported configuration options.

Language Server Features

Auto Completion:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/auto-complete.gif

Code Linting with pycodestyle and pyflakes:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/linting.gif

Signature Help:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/signature-help.gif

Go to definition:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/goto-definition.gif

Hover:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/hover.gif

Find References:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/references.gif

Document Symbols:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-symbols.gif

Document Formatting:

https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-format.gif

Development

To run the test suite:

pip install .[test] && pytest

Develop against VS Code

The Python language server can be developed against a local instance of Visual Studio Code.

Install VSCode

# Setup a virtual env
virtualenv env
. env/bin/activate

# Install pyls
pip install .

# Install the vscode-client extension
cd vscode-client
yarn install

# Run VSCode which is configured to use pyls
# See the bottom of vscode-client/src/extension.ts for info
yarn run vscode -- $PWD/../

Then to debug, click View -> Output and in the dropdown will be pyls. To refresh VSCode, press Cmd + r

License

This project is made available under the MIT License.

Release files for python-language-server 0.36.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-language-server 0.36.2
File Size Uploaded
python-language-server-0.36.2.tar.gz 74.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-language-server 0.36.2
File Interpreter ABI Platform
python_language_server-0.36.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 126.2 kB

Release files / python-language-server-0.36.2.tar.gz

Download URL python-language-server-0.36.2.tar.gz
Size 74.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9984c84a67ee2c5102c8e703215f407fcfa5e62b0ae86c9572d0ada8c4b417b0
BLAKE2b-256 checksum
How to use checksums
66300c31b052ede62bbeddf4110db57c78d3c704506178caa18b2f0be2271293
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / python_language_server-0.36.2-py2.py3-none-any.whl

Download URL python_language_server-0.36.2-py2.py3-none-any.whl
Size 51.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a0ad0aca03f4a20c1c40f4f230c6773eac82c9b7cdb026cb09ba10237f4815d5
BLAKE2b-256 checksum
How to use checksums
9d2785acd3c6dc88bfec5fa14822b88a8d048e13132a0475047950c1aa85ef0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.36.2 This release

2 release files

0.35.1

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.3

2 release files

0.33.2

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.9

2 release files

0.31.7

2 release files

0.31.6

2 release files

0.31.5

2 release files

0.31.4

1 release file

0.31.3

1 release file

0.31.2

1 release file

0.31.1

1 release file

0.31.0

1 release file

0.30.0

1 release file

0.29.3

1 release file

0.29.2

1 release file

0.29.1

1 release file

0.29.0

1 release file

0.28.3

1 release file

0.28.2

1 release file

0.28.1

1 release file

0.28.0

1 release file

0.27.0

1 release file

0.26.1

1 release file

0.26.0

1 release file

0.25.0

1 release file

0.24.0

1 release file

0.23.2

1 release file

0.22.0

1 release file

0.21.5

1 release file

0.21.4

1 release file

0.21.3

1 release file

0.21.2

1 release file

0.21.1

1 release file

0.21.0

1 release file

0.20.0

1 release file

0.19.0

1 release file

0.18.0

1 release file

0.17.2

1 release file

0.17.1

1 release file

0.17.0

1 release file

0.16.0

1 release file

0.15.1

1 release file

0.15.0

1 release file

0.14.0

1 release file

0.13.0

1 release file

0.12.6

1 release file

0.12.2

1 release file

0.12.1

1 release file

0.12.0

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.0

1 release file

0.9.0

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page