Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Python language server

NOTE: This project is no longer being maintained or in active development. See the Sourcegraph fork of Microsoft's Python language server.

Build Status

This is a language server for Python that adheres to the Language Server Protocol (LSP). It uses Jedi to perform source code analysis. Python versions 2.x and 3.x are supported.

Automatic Dependency Installation

Configuring pip

python-langserver uses pip to fetch dependencies. To configure the behavior of pip, you can supply the pipArgs initalizationOption field inside the initalize request parameters. pipArgs specifies a list of arguments to add to the invocation of pip, for example:

InitializeParams {
	"initializationOptions": {
        "pipArgs": [
        // ...

This will tell pip to use as its base package index and as an extra package index, as described in the pip documentation.

Note, when using this language server with Sourcegraph - you can set the initializationOptions in your site configuration:

    // ...
    "langservers": [
            "language": "python",
            "initializationOptions": {
                "pipArgs": [
    // ...

Inference of Package Names

The language server will not run or pip install. When it encounters an import, it tries to infer the package name and run pip download. (This also avoids running the downloaded package's This is expected to work as long as the name of the package on PyPI (or your private package index) is the same as the name that's imported in the source code.


Getting started

You'll need Python version 3.6 or greater or pyenv installed. You will also need pipenv installed:

  1. pipenv install
  2. pipenv run python --mode=tcp --addr=2087

To try it in Visual Studio Code, install the vscode-client extension and then open up a .py file.


Run make test.

The tests require pytest. Note that some tests may fail if you're using virtualenv instead of the system Python.


Language server which talks LSP via JSONRPC for Python.







No releases published


No packages published