Skip to content

Commit 0512e56

Browse files
authored
Merge branch 'develop' into develop
2 parents bf2c3ce + 3215ea6 commit 0512e56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+505
-483
lines changed

.github/workflows/static.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
OS: 'linux'
2323
timeout-minutes: 2
2424
steps:
25-
- uses: actions/cache@v1
25+
- uses: actions/cache@v4
2626
with:
2727
path: ~/.cache/pip
2828
key: static-pip-${{ hashFiles('pyproject.toml') }}
2929
restore-keys: static-pip-
30-
- uses: actions/checkout@v2
31-
- uses: actions/setup-python@v2
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
3232
with:
3333
# TODO: check with Python 3, but need to fix the
3434
# errors first

.github/workflows/test-linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~/.cache/pip
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

.github/workflows/test-mac.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616
jobs:
1717
build:
1818
name: Mac Py${{ matrix.PYTHON_VERSION }}
19-
runs-on: macos-latest
19+
runs-on: macos-13
2020
env:
2121
CI: 'true'
2222
OS: 'macos'
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~/Library/Caches/pip
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

.github/workflows/test-win.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
PYTHON_VERSION: ['3.10', '3.9', '3.8']
2828
timeout-minutes: 10
2929
steps:
30-
- uses: actions/cache@v1
30+
- uses: actions/cache@v4
3131
with:
3232
path: ~\AppData\Local\pip\Cache
3333
key: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: ${{ runner.os }}-${{ matrix.PYTHON_VERSION }}-pip-
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v2
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.PYTHON_VERSION }}
3939
architecture: 'x64'

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
# History of changes
22

3+
## Version 1.11.0 (2024/03/29)
4+
5+
### New features
6+
7+
* Remove the `rope_rename` plugin. People that were using it need to install
8+
the `pylsp-rope` third-party plugin instead.
9+
* Add support for Pylint 3.1
10+
11+
### Issues Closed
12+
13+
* [Issue 255](https://github.com/python-lsp/python-lsp-server/issues/255) - Confusion about rename support ([PR 515](https://github.com/python-lsp/python-lsp-server/pull/515) by [@doolio](https://github.com/doolio))
14+
15+
In this release 1 issue was closed.
16+
17+
### Pull Requests Merged
18+
19+
* [PR 543](https://github.com/python-lsp/python-lsp-server/pull/543) - Bump pylint to `>=3.1,<4`, by [@bnavigator](https://github.com/bnavigator)
20+
* [PR 541](https://github.com/python-lsp/python-lsp-server/pull/541) - Add fallback for `ujson` import, by [@Savalek](https://github.com/Savalek)
21+
* [PR 538](https://github.com/python-lsp/python-lsp-server/pull/538) - Remove `.config/flake8` reference in Readme, by [@justin-f-perez](https://github.com/justin-f-perez)
22+
* [PR 536](https://github.com/python-lsp/python-lsp-server/pull/536) - Fix isort plugin name in Readme, by [@Piraty](https://github.com/Piraty)
23+
* [PR 515](https://github.com/python-lsp/python-lsp-server/pull/515) - Remove built-in `rope_rename` plugin, by [@doolio](https://github.com/doolio) ([255](https://github.com/python-lsp/python-lsp-server/issues/255))
24+
* [PR 470](https://github.com/python-lsp/python-lsp-server/pull/470) - Add contributing guide to setup dev environment, by [@staticf0x](https://github.com/staticf0x)
25+
26+
In this release 6 pull requests were closed.
27+
28+
----
29+
30+
## Version 1.10.1 (2024/03/12)
31+
32+
### Issues Closed
33+
34+
* [Issue 529](https://github.com/python-lsp/python-lsp-server/issues/529) - Autoimports: sqlite3.OperationalError: database is locked ([PR 530](https://github.com/python-lsp/python-lsp-server/pull/530) by [@last-partizan](https://github.com/last-partizan))
35+
36+
In this release 1 issue was closed.
37+
38+
### Pull Requests Merged
39+
40+
* [PR 530](https://github.com/python-lsp/python-lsp-server/pull/530) - Fix progress reporting with autoimport plugin, by [@last-partizan](https://github.com/last-partizan) ([529](https://github.com/python-lsp/python-lsp-server/issues/529))
41+
* [PR 528](https://github.com/python-lsp/python-lsp-server/pull/528) - Improve error message about missing `websockets` module, by [@tomplus](https://github.com/tomplus)
42+
43+
In this release 2 pull requests were closed.
44+
45+
----
46+
347
## Version 1.10.0 (2024/01/21)
448

549
### New features

CONFIGURATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This server can be configured using the `workspace/didChangeConfiguration` metho
99
| `pylsp.plugins.flake8.enabled` | `boolean` | Enable or disable the plugin. | `false` |
1010
| `pylsp.plugins.flake8.exclude` | `array` of `string` items | List of files or directories to exclude. | `[]` |
1111
| `pylsp.plugins.flake8.extendIgnore` | `array` of `string` items | List of errors and warnings to append to ignore list. | `[]` |
12+
| `pylsp.plugins.flake8.extendSelect` | `array` of `string` items | List of errors and warnings to append to select list. | `[]` |
1213
| `pylsp.plugins.flake8.executable` | `string` | Path to the flake8 executable. | `"flake8"` |
1314
| `pylsp.plugins.flake8.filename` | `string` | Only check for filenames matching the patterns in this list. | `null` |
1415
| `pylsp.plugins.flake8.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` |
@@ -20,6 +21,7 @@ This server can be configured using the `workspace/didChangeConfiguration` metho
2021
| `pylsp.plugins.flake8.select` | `array` of unique `string` items | List of errors and warnings to enable. | `null` |
2122
| `pylsp.plugins.jedi.auto_import_modules` | `array` of `string` items | List of module names for jedi.settings.auto_import_modules. | `["numpy"]` |
2223
| `pylsp.plugins.jedi.extra_paths` | `array` of `string` items | Define extra paths for jedi.Script. | `[]` |
24+
| `pylsp.plugins.jedi.prioritize_extra_paths` | `boolean` | Whether to place extra_paths at the beginning (true) or end (false) of `sys.path` | `false` |
2325
| `pylsp.plugins.jedi.env_vars` | `object` | Define environment variables for jedi.Script and Jedi.names. | `null` |
2426
| `pylsp.plugins.jedi.environment` | `string` | Define environment for jedi.Script and Jedi.names. | `null` |
2527
| `pylsp.plugins.jedi_completion.enabled` | `boolean` | Enable or disable the plugin. | `true` |

CONTRIBUTING.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Setup the environment
2+
3+
1. Clone the repo: `git clone [email protected]:python-lsp/python-lsp-server.git`
4+
2. Create the virtual environment: `python -m venv .venv`
5+
3. Activate: `source .venv/bin/activate`
6+
4. Install an editable installation: `pip install -e .`
7+
- This will ensure you'll see your edits immediately without reinstalling the project
8+
5. Configure your editor to point the pylsp executable to the one in `.venv`
9+
10+
## Trying out if it works
11+
12+
Go to file `pylsp/python_lsp.py`, function `start_io_lang_server`,
13+
and on the first line of the function, add some logging:
14+
15+
```py
16+
log.info("It works!")
17+
```
18+
19+
Save the file, restart the LSP server and you should see the log line:
20+
21+
```
22+
2023-10-12 16:46:38,320 CEST - INFO - pylsp._utils - It works!
23+
```
24+
25+
Now the project is setup in a way you can quickly iterate change you want to add.
26+
27+
# Running tests
28+
29+
1. Install runtime dependencies: `pip install .[all]`
30+
2. Install test dependencies: `pip install .[test]`
31+
3. Run `pytest`: `pytest -v`
32+
33+
## Useful pytest options
34+
35+
- To run a specific test file, use `pytest test/test_utils.py`
36+
- To run a specific test function within a test file,
37+
use `pytest test/test_utils.py::test_debounce`
38+
- To run tests matching a certain expression, use `pytest -k format`
39+
- To increase verbosity of pytest, use `pytest -v` or `pytest -vv`
40+
- To enter a debugger on failed tests, use `pytest --pdb`

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ sudo apt-get install python3-pylsp
6262
or Fedora Linux
6363

6464
```
65-
sudo dnf install python-lsp-server
65+
sudo dnf install python3-lsp-server
6666
```
6767

6868
or Arch Linux
@@ -82,7 +82,7 @@ apk add py3-lsp-server
8282
Installing these plugins will add extra functionality to the language server:
8383
8484
- [pylsp-mypy](https://github.com/Richardk2n/pylsp-mypy): [MyPy](http://mypy-lang.org/) type checking for Python >=3.8.
85-
- [pyls-isort](https://github.com/chantera/python-lsp-isort): code formatting using [isort](https://github.com/PyCQA/isort) (automatic import sorting).
85+
- [python-lsp-isort](https://github.com/chantera/python-lsp-isort): code formatting using [isort](https://github.com/PyCQA/isort) (automatic import sorting).
8686
- [python-lsp-black](https://github.com/python-lsp/python-lsp-black): code formatting using [Black](https://github.com/psf/black).
8787
- [pyls-memestra](https://github.com/QuantStack/pyls-memestra): detecting the use of deprecated APIs.
8888
- [pylsp-rope](https://github.com/python-rope/pylsp-rope): Extended refactoring capabilities using [Rope](https://github.com/python-rope/rope).
@@ -101,7 +101,7 @@ Like all language servers, configuration can be passed from the client that talk
101101
`python-lsp-server` depends on other tools, like flake8 and pycodestyle. These tools can be configured via settings passed from the client (as above), or alternatively from other configuration sources. The following sources are available:
102102
103103
- `pycodestyle`: discovered in `~/.config/pycodestyle`, `setup.cfg`, `tox.ini` and `pycodestyle.cfg`.
104-
- `flake8`: discovered in `~/.config/flake8`, `.flake8`, `setup.cfg` and `tox.ini`
104+
- `flake8`: discovered in `.flake8`, `setup.cfg` and `tox.ini`
105105
106106
The default configuration sources are `pycodestyle` and `pyflakes`. If you would like to use `flake8`, you will need to:
107107

pylsp/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626

2727

28-
def add_arguments(parser):
28+
def add_arguments(parser) -> None:
2929
parser.description = "Python Language Server"
3030

3131
parser.add_argument(
@@ -67,7 +67,7 @@ def add_arguments(parser):
6767
)
6868

6969

70-
def main():
70+
def main() -> None:
7171
parser = argparse.ArgumentParser()
7272
add_arguments(parser)
7373
args = parser.parse_args()
@@ -94,7 +94,7 @@ def _binary_stdio():
9494
return stdin, stdout
9595

9696

97-
def _configure_logger(verbose=0, log_config=None, log_file=None):
97+
def _configure_logger(verbose=0, log_config=None, log_file=None) -> None:
9898
root_logger = logging.root
9999

100100
if log_config:

pylsp/_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def find_parents(root, path, names):
8888
return []
8989

9090
if not os.path.commonprefix((root, path)):
91-
log.warning("Path %s not in %s", path, root)
91+
log.warning("Path %r not in %r", path, root)
9292
return []
9393

9494
# Split the relative by directory, generate all the parent directories, then check each of them.
@@ -175,8 +175,8 @@ def escape_plain_text(contents: str) -> str:
175175
"""
176176
Format plain text to display nicely in environments which do not respect whitespaces.
177177
"""
178-
contents = contents.replace("\t", "\u00A0" * 4)
179-
contents = contents.replace(" ", "\u00A0" * 2)
178+
contents = contents.replace("\t", "\u00a0" * 4)
179+
contents = contents.replace(" ", "\u00a0" * 2)
180180
return contents
181181

182182

0 commit comments

Comments
 (0)