Skip to content

Commit 1833875

Browse files
authored
Merge pull request #6 from xiaoxiae/develop
Rewrite README from rst to md
2 parents 0a14088 + 5253201 commit 1833875

File tree

4 files changed

+143
-172
lines changed

4 files changed

+143
-172
lines changed

Diff for: MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.rst
1+
include README.md
22
include versioneer.py
33
include pyls/_version.py
44
include LICENSE

Diff for: README.md

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
- [pyls-memestra](https://github.com/QuantStack/pyls-memestra) for detecting the use of deprecated APIs
50+
51+
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.
52+
53+
## Configuration
54+
55+
Configuration is loaded from zero or more configuration sources. Currently implemented are:
56+
57+
- pycodestyle: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`.
58+
- flake8: discovered in `~/.config/flake8`, `setup.cfg`, `tox.ini` and `flake8.cfg`
59+
60+
The default configuration source is pycodestyle. Change the `pyls.configurationSources` setting to `['flake8']` in order to respect flake8 configuration instead.
61+
62+
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.
63+
64+
To enable pydocstyle for linting docstrings add the following setting in your LSP configuration:
65+
`\` "pyls.plugins.pydocstyle.enabled": true \``
66+
67+
See [vscode-client/package.json](vscode-client/package.json) for the full set of supported configuration options.
68+
69+
## Language Server Features
70+
71+
Auto Completion:
72+
73+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/auto-complete.gif)
74+
75+
Code Linting with pycodestyle and pyflakes:
76+
77+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/linting.gif)
78+
79+
Signature Help:
80+
81+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/signature-help.gif)
82+
83+
Go to definition:
84+
85+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/goto-definition.gif)
86+
87+
Hover:
88+
89+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/hover.gif)
90+
91+
Find References:
92+
93+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/references.gif)
94+
95+
Document Symbols:
96+
97+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/document-symbols.gif)
98+
99+
Document Formatting:
100+
101+
![image](https://raw.githubusercontent.com/python-ls/python-ls/develop/resources/document-format.gif)
102+
103+
## Development
104+
105+
To run the test suite:
106+
107+
```
108+
pip install .[test] && pytest
109+
```
110+
111+
# Develop against VS Code
112+
113+
The Python language server can be developed against a local instance of
114+
Visual Studio Code.
115+
116+
Install [VSCode](https://code.visualstudio.com/download)
117+
118+
```bash
119+
# Setup a virtual env
120+
virtualenv env
121+
. env/bin/activate
122+
123+
# Install pyls
124+
pip install .
125+
126+
# Install the vscode-client extension
127+
cd vscode-client
128+
yarn install
129+
130+
# Run VSCode which is configured to use pyls
131+
# See the bottom of vscode-client/src/extension.ts for info
132+
yarn run vscode -- $PWD/../
133+
```
134+
135+
Then to debug, click View -> Output and in the dropdown will be pyls.
136+
To refresh VSCode, press `Cmd + r`
137+
138+
## License
139+
140+
This project is made available under the MIT License.

Diff for: README.rst

-170
This file was deleted.

Diff for: setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import versioneer
55
import sys
66

7-
README = open('README.rst', 'r').read()
7+
README = open('README.md', 'r').read()
88

99
install_requires = [
1010
'configparser; python_version<"3.0"',
@@ -28,6 +28,7 @@
2828
description='Python Language Server for the Language Server Protocol',
2929

3030
long_description=README,
31+
long_description_content_type='text/markdown',
3132

3233
# The project's main homepage.
3334
url='https://github.com/python-ls/python-ls',

0 commit comments

Comments
 (0)