Skip to content

Commit 6fc93ce

Browse files
committed
Rewrite README from rst to md
1 parent 2239618 commit 6fc93ce

File tree

2 files changed

+139
-168
lines changed

2 files changed

+139
-168
lines changed

README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Python Language Server
2+
3+
[![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)
4+
5+
A Python 2.7 and 3.5+ implementation of the [Language Server Protocol](https://github.com/Microsoft/language-server-protocol).
6+
7+
## Installation
8+
9+
The base language server requires [Jedi](https://github.com/davidhalter/jedi) to provide Completions, Definitions, Hover, References, Signature Help, and Symbols:
10+
11+
```
12+
pip install python-language-server
13+
```
14+
15+
If the respective dependencies are found, the following optional providers will be enabled:
16+
- [Rope](https://github.com/python-rope/rope) for Completions and renaming
17+
- [Pyflakes](https://github.com/PyCQA/pyflakes) linter to detect various errors
18+
- [McCabe](https://github.com/PyCQA/mccabe) linter for complexity checking
19+
- [pycodestyle](https://github.com/PyCQA/pycodestyle) linter for style checking
20+
- [pydocstyle](https://github.com/PyCQA/pydocstyle) linter for docstring style checking (disabled by default)
21+
- [autopep8](https://github.com/hhatto/autopep8) for code formatting
22+
- [YAPF](https://github.com/google/yapf) for code formatting (preferred over autopep8)
23+
24+
Optional providers can be installed using the `extras` syntax. To install [YAPF](https://github.com/google/yapf) formatting for example:
25+
26+
```
27+
pip install 'python-language-server[yapf]'
28+
```
29+
30+
All optional providers can be installed using:
31+
32+
```
33+
pip install 'python-language-server[all]'
34+
```
35+
36+
If you get an error similar to `'install_requires' must be a string or list of strings` then please upgrade setuptools before trying again.
37+
38+
```
39+
pip install -U setuptools
40+
```
41+
42+
### 3rd Party Plugins
43+
44+
Installing these plugins will add extra functionality to the language server:
45+
46+
- [pyls-mypy](https://github.com/tomv564/pyls-mypy) Mypy type checking for Python 3
47+
- [pyls-isort](https://github.com/paradoxxxzero/pyls-isort) Isort import sort code formatting
48+
- [pyls-black](https://github.com/rupert/pyls-black) for code formatting using [Black](https://github.com/ambv/black)
49+
50+
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.
51+
52+
## Configuration
53+
54+
Configuration is loaded from zero or more configuration sources. Currently implemented are:
55+
56+
- pycodestyle: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`.
57+
- flake8: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg`
58+
59+
The default configuration source is pycodestyle. Change the `pyls.configurationSources` setting to `['flake8']` in order to respect flake8 configuration instead.
60+
61+
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.
62+
63+
To enable pydocstyle for linting docstrings add the following setting in your LSP configuration:
64+
`\` "pyls.plugins.pydocstyle.enabled": true \``
65+
66+
See [vscode-client/package.json](vscode-client/package.json) for the full set of supported configuration options.
67+
68+
## Language Server Features
69+
70+
Auto Completion:
71+
72+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/auto-complete.gif)
73+
74+
Code Linting with pycodestyle and pyflakes:
75+
76+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/linting.gif)
77+
78+
Signature Help:
79+
80+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/signature-help.gif)
81+
82+
Go to definition:
83+
84+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/goto-definition.gif)
85+
86+
Hover:
87+
88+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/hover.gif)
89+
90+
Find References:
91+
92+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/references.gif)
93+
94+
Document Symbols:
95+
96+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-symbols.gif)
97+
98+
Document Formatting:
99+
100+
![image](https://raw.githubusercontent.com/palantir/python-language-server/develop/resources/document-format.gif)
101+
102+
## Development
103+
104+
To run the test suite:
105+
106+
```
107+
pip install .[test] && pytest
108+
```
109+
110+
# Develop against VS Code
111+
112+
The Python language server can be developed against a local instance of
113+
Visual Studio Code.
114+
115+
Install [VSCode](https://code.visualstudio.com/download)
116+
117+
```bash
118+
# Setup a virtual env
119+
virtualenv env
120+
. env/bin/activate
121+
122+
# Install pyls
123+
pip install .
124+
125+
# Install the vscode-client extension
126+
cd vscode-client
127+
yarn install
128+
129+
# Run VSCode which is configured to use pyls
130+
# See the bottom of vscode-client/src/extension.ts for info
131+
yarn run vscode -- $PWD/../
132+
```
133+
134+
Then to debug, click View -> Output and in the dropdown will be pyls.
135+
To refresh VSCode, press `Cmd + r`
136+
137+
## License
138+
139+
This project is made available under the MIT License.

README.rst

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)