|
1 | 1 | # python-lsp-isort
|
2 | 2 |
|
3 |
| -isort plugin for the Python LSP Server |
| 3 | +[isort](https://github.com/PyCQA/isort) plugin for the [Python LSP Server](https://github.com/python-lsp/python-lsp-server). |
4 | 4 |
|
5 |
| -This is a plugin for [Python LSP Server](https://github.com/python-lsp/python-lsp-server). |
| 5 | +## Install |
6 | 6 |
|
7 |
| -## Installation |
| 7 | +In the same `virtualenv` as `python-lsp-server`: |
8 | 8 |
|
9 |
| -To use this plugin, you need to install this plugin in the same virtualenv as python-lsp-server itself. |
10 |
| - |
11 |
| -``` bash |
| 9 | +```shell |
12 | 10 | pip install python-lsp-isort
|
13 | 11 | ```
|
14 | 12 |
|
15 |
| -Then run `python-lsp-server` as usual, the plugin will be auto-discovered by |
16 |
| -`python-lsp-server` if you've installed it to the right environment. Refer to |
17 |
| -`python-lsp-server` and your IDE/text editor documentation on how to setup |
18 |
| -`python-lsp-server`. |
19 |
| - |
20 | 13 | ## Configuration
|
21 | 14 |
|
22 |
| -... TODO ... |
23 |
| - |
24 |
| -## Features |
25 |
| - |
26 |
| -This plugin adds the following features to `pylsp`: |
27 |
| - |
28 |
| -- ... TODO ... |
29 |
| - |
30 |
| -## Developing |
31 |
| - |
32 |
| -Install development dependencies with (you might want to create a virtualenv first): |
33 |
| - |
34 |
| -``` bash |
35 |
| -git clone https://github.com/chantera/python-lsp-isort python-lsp-isort |
36 |
| -cd python-lsp-isort |
37 |
| -pip install -e '.[dev]' |
38 |
| -``` |
39 |
| - |
40 |
| -### Enabling logging |
41 |
| - |
42 |
| -To enable logging in pylsp: |
43 |
| - |
44 |
| - pylsp -v --log-file /tmp/pylsp.log |
45 |
| - |
46 |
| -### Enabling tcp mode |
47 |
| - |
48 |
| -Normally, editors communicate with language servers through standard |
49 |
| -input/output. Optionally, you can run pylsp in tcp mode if you want to be able |
50 |
| -to use the standard input/output, for example so you can use IPython or pudb, |
51 |
| -using the --tcp flag: |
52 |
| - |
53 |
| - pylsp -v --log-file /tmp/pylsp.log --tcp --port 7090 |
54 |
| - |
55 |
| -Consult your lsp client documentation on how to connect to tcp-mode language |
56 |
| -server, but if it doesn't support connecting to a language server via TCP, then |
57 |
| -usually can configure `netcat`/`nc` to be your "language server" that will |
58 |
| -proxy requests to a tcp-mode language server: |
59 |
| - |
60 |
| - nc localhost 7090 |
61 |
| - |
62 |
| -TODO: document how to connect to pylsp via pylsp from LSP clients. |
63 |
| -### Testing |
64 |
| - |
65 |
| -Run `pytest` to run plugin tests. |
66 |
| - |
67 |
| - |
68 |
| -## Publishing |
69 |
| - |
70 |
| -If this is your first time publishing to PyPI, follow the instruction at [Twine |
71 |
| -docs](https://packaging.python.org/guides/distributing-packages-using-setuptools/#create-an-account) |
72 |
| -to create an PyPI account and setup Twine. |
73 |
| - |
74 |
| -1. Update version number in `setup.cfg`. |
75 |
| - |
76 |
| -2. Build a package using setuptools: |
77 |
| - |
78 |
| -``` bash |
79 |
| -python -m build |
80 |
| -twine check dist/* |
81 |
| -``` |
82 |
| - |
83 |
| -3. Tag the release: |
84 |
| - |
85 |
| -``` |
86 |
| -git tag --sign 0.1.3 |
87 |
| -git push origin 0.1.3 |
88 |
| -``` |
89 |
| - |
90 |
| -4. Then upload using Twine: |
91 |
| - |
92 |
| -``` |
93 |
| -twine upload --sign dist/* |
94 |
| -``` |
95 |
| - |
96 |
| -Alternatively, you may want to upload to Test PyPI first before going live: |
97 |
| - |
98 |
| -``` |
99 |
| -twine upload --repository testpypi dist/* |
100 |
| -``` |
| 15 | +The plugin follows [python-lsp-server's configuration](https://github.com/python-lsp/python-lsp-server/#configuration). |
| 16 | +These are the valid configuration keys: |
101 | 17 |
|
102 |
| -## Credits |
| 18 | +- `pylsp.plugins.isort.enabled`: boolean to enable/disable the plugin. `true` by default. |
| 19 | +- `pylsp.plugins.isort.*`: any other key-value pair under `pylsp.plugins.isort` is passed to `isort.settings.Config`. See the [reference](https://pycqa.github.io/isort/reference/isort/settings.html#config) for details. |
103 | 20 |
|
104 |
| -This package was created with |
105 |
| -[Cookiecutter](https://github.com/audreyr/cookiecutter) from |
106 |
| -[python-lsp/cookiecutter-pylsp-plugin](https://github.com/python-lsp/cookiecutter-pylsp-plugin) |
107 |
| -project template. |
| 21 | +Note that any configurations passed to isort via `pylsp` will override the settings in a config file, such as `pyproject.toml`. |
0 commit comments