Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite README from rst to md #6

Merged
merged 8 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.rst
include README.md
include versioneer.py
include pyls/_version.py
include LICENSE
Expand Down
139 changes: 139 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Python Language Server

[![image](https://github.com/python-ls/python-ls/workflows/Linux%20tests/badge.svg)](https://github.com/python-ls/python-ls/actions?query=workflow%3A%22Linux+tests%22) [![image](https://github.com/python-ls/python-ls/workflows/Mac%20tests/badge.svg)](https://github.com/python-ls/python-ls/actions?query=workflow%3A%22Mac+tests%22) [![image](https://github.com/python-ls/python-ls/workflows/Windows%20tests/badge.svg)](https://github.com/python-ls/python-ls/actions?query=workflow%3A%22Windows+tests%22) [![image](https://img.shields.io/github/license/python-ls/python-ls.svg)](https://github.com/python-ls/python-ls/blob/master/LICENSE)

A Python 2.7 and 3.5+ implementation of the [Language Server Protocol](https://github.com/Microsoft/language-server-protocol).

## Installation

The base language server requires [Jedi](https://github.com/davidhalter/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](https://github.com/python-rope/rope) for Completions and renaming
- [Pyflakes](https://github.com/PyCQA/pyflakes) linter to detect various errors
- [McCabe](https://github.com/PyCQA/mccabe) linter for complexity checking
- [pycodestyle](https://github.com/PyCQA/pycodestyle) linter for style checking
- [pydocstyle](https://github.com/PyCQA/pydocstyle) linter for docstring style checking (disabled by default)
- [autopep8](https://github.com/hhatto/autopep8) for code formatting
- [YAPF](https://github.com/google/yapf) for code formatting (preferred over autopep8)

Optional providers can be installed using the `extras` syntax. To install [YAPF](https://github.com/google/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:

- [pyls-mypy](https://github.com/tomv564/pyls-mypy) Mypy type checking for Python 3
- [pyls-isort](https://github.com/paradoxxxzero/pyls-isort) Isort import sort code formatting
- [pyls-black](https://github.com/rupert/pyls-black) for code formatting using [Black](https://github.com/ambv/black)

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](vscode-client/package.json) for the full set of supported configuration options.

## Language Server Features

Auto Completion:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/auto-complete.gif)

Code Linting with pycodestyle and pyflakes:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/linting.gif)

Signature Help:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/signature-help.gif)

Go to definition:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/goto-definition.gif)

Hover:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/hover.gif)

Find References:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/references.gif)

Document Symbols:

![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-symbols.gif)

Document Formatting:

![image](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](https://code.visualstudio.com/download)

```bash
# 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.
168 changes: 0 additions & 168 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import versioneer
import sys

README = open('README.rst', 'r').read()
README = open('README.md', 'r').read()
krassowski marked this conversation as resolved.
Show resolved Hide resolved

install_requires = [
'configparser; python_version<"3.0"',
Expand Down