A Python 3.9+ implementation of the Language Server Protocol using Rope for completion, renaming, definitions, hover, references, signature help and symbols.
Development and issue tracking are on Codefloe, with a GitHub mirror. See the CI runs for current test results.
Use distribution packages where available, or install with pip:
python3 -m pip install rope-language-server
rols --helpConfigure your editor to launch rols. It communicates over standard input and
output by default. The libraries you want Rope to analyse must be available to
the Python interpreter running rols.
The following optional providers are loaded when their dependencies are installed. Some require explicit enabling in the editor's settings:
- Pyflakes detects errors.
- McCabe checks complexity.
- pycodestyle checks style.
- pydocstyle checks docstring style and is disabled by default.
- autopep8 formats code.
- YAPF formats code and takes precedence over autopep8.
- flake8 checks errors and style and is disabled by default.
- pylint checks code and is disabled by default.
Install a provider with the matching extra, for example:
python3 -m pip install "rope-language-server[yapf]"Install all optional linting and formatting providers with:
python3 -m pip install "rope-language-server[all]"These integrations are useful references for additional tools:
- Mypy integration for type checking.
- python-lsp-isort for sorting imports with isort.
- python-lsp-black for formatting with Black.
- pyls-memestra for detecting deprecated APIs.
- python-lsp-ruff for linting with Ruff.
Installing a plugin written for another server does not automatically make it
available here. Rope language server discovers plugins through the rols
entry-point group and uses rols_* hooks. Plugins must implement that interface.
See the built-in plugins, hook specifications
and entry-point declarations for examples.
Pass settings from your editor under the rols namespace. The available options
are documented in CONFIGURATION.md. For example, to enable
Rope autoimport:
{
"rols": {
"plugins": {
"rope_autoimport": {
"enabled": true
}
}
}
}The server also reads configuration for its linting tools:
pycodestylereads~/.config/pycodestyle,setup.cfg,tox.iniandpycodestyle.cfg.flake8reads.flake8,setup.cfgandtox.iniin the project.
The default configuration source is pycodestyle. To use flake8:
- Install the
flake8extra. - Disable
rols.plugins.pycodestyle.enabled,rols.plugins.mccabe.enabledandrols.plugins.pyflakes.enabledto avoid duplicate diagnostics. - Set
rols.plugins.flake8.enabledtotrue. - Set
rols.configurationSourcesto["flake8"].
See the tools' own documentation for their configuration-file options:
Settings are merged in this order, with later values overriding earlier ones: plugin defaults and initialisation options, editor settings, user configuration files, then project configuration files.
For example, pycodestyle ignores can be set in the editor with
rols.plugins.pycodestyle.ignore, or in ~/.config/pycodestyle or a project
configuration file:
[pycodestyle]
ignore = E226,E302,E41Install the WebSockets extra and start the server with a port number:
python3 -m pip install "rope-language-server[websockets]"
rols --ws --port 2087- Completion
- Autoimport, disabled by default
- Code linting
- Code actions
- Renaming
- Signature help
- Go to definition
- Hover
- Find references
- Document symbols
- Document formatting
- Code folding
- Multiple workspaces
See CONTRIBUTING.md for checkout and editor setup. Install the development dependencies using distribution packages, or use an editable pip installation:
python3 -m pip install -e ".[all,websockets,test]"Run the checkout directly with logging:
python3 -m rols -v --log-file /tmp/rols.log # Info-level logging
python3 -m rols -vv --log-file /tmp/rols.log # Debug-level loggingRun the test suite:
python3 -m pytestUse the same Black version as CI to avoid formatting differences between releases:
python3 -m pip install black==25.11.0
python3 -m black .Check formatting without changing files:
python3 -m black --check .After changing the configuration schema, regenerate its Markdown documentation:
python3 scripts/jsonschema2md.py rols/config/schema.json CONFIGURATION.mdFor cancellation and responsiveness checks, see docs/cancellation-testing.md.
This project is available under the MIT licence.