pylsp-rope
Extended refactoring capabilities for Python LSP Server using Rope.
This is a plugin for Python LSP Server, so you also need to have it installed.
python-lsp-server already has basic built-in support for using Rope, but it's currently limited to just renaming and completion. Installing this plugin adds more refactoring functionality to python-lsp-server.
Installation
To use this plugin, you need to install this plugin in the same virtualenv as python-lsp-server itself.
pip install pylsp-rope
Then run pylsp as usual, the plugin will be auto-discovered by
python-lsp-server if you've installed it to the right environment. On Vim,
refer to Rope in Vim or
Neovim. For
other editors, refer to your IDE/text editor's documentation on how to setup a
language server.
Features
This plugin adds the following features to python-lsp-server:
Rename:
- implemented: variables, classes, functions (disabled by default)
- coming soon: modules, packages (disabled by default)
Code Action:
- extract method
- extract variable
- inline method/variable/parameter
- use function
- method to method object
- convert local variable to field
- organize imports
- introduce parameter
- generate variable/function/class from undefined variable
Refer to Rope documentation for more details on how these refactoring works.
Usage
Rename
When Rename is triggered, rename the symbol under the cursor. If the symbol under the cursor points to a module/package, it will move that module/package files.
Extract method
Variants:
- Extract method
- Extract global method
- Extract method including similar statements
- Extract global method including similar statements
When CodeAction is triggered and the cursor is on any block of code, extract that expression into a method. Optionally, similar statements can also be extracted.
Extract variable
Variants:
- Extract variable
- Extract global variable
- Extract variable including similar statements
- Extract global variable including similar statements
When CodeAction is triggered and the cursor is on a expression, extract that expression into a variable. Optionally, similar statements can also be extracted.
Inline
When CodeAction is triggered and the cursor is on a resolvable Python variable, replace all calls to that method with the method body.
Use function
When CodeAction is triggered and the cursor is on the function name of a def
statement, try to replace code whose AST matches the selected function with a
call to the function.
Method to method object
When CodeAction is triggered and the cursor is on the function name of a def
statement, create a callable class to replace that method. You may want to
inline the method afterwards to remove the indirection.
Convert local variable to field
When CodeAction is triggered wand the cursor is on a local variable inside a method, convert that local variable to an attribute.
Organize import
Trigger CodeAction anywhere in a Python file to organize imports.
Introduce parameter
When CodeAction is triggered and the cursor is selecting a Python variable or attribute, make that variable/attribute a parameter.
Generate code
Variants:
- Generate variable
- Generate function
- Generate class
- Generate module
- Generate package
When CodeAction is triggered and the cursor is on an undefined Python variable, generate an empty variable/function/class/module/package for that name.
Configuration
You can enable rename support using pylsp-rope with workspace config key
pylsp.plugins.pylsp_rope.rename.
Note that this differs from the config key pylsp.plugins.rope_rename.enabled
that is used for the rope rename implementation using the python-lsp-rope's
builtin rope_rename plugin. To avoid confusion, avoid enabling more than one
python-lsp-server rename plugin. In other words, you should set both
pylsp.plugins.rope_rename.enabled = false and pylsp.plugins.jedi_rename.enabled = false
when pylsp-rope rename is enabled.
Caveat
Support for working on unsaved document is currently experimental, but it should work.
This plugin is in early development, so expect some bugs. Please report in Github issue tracker if you had any issues with the plugin.
Developing
See CONTRIBUTING.md.
Packaging status
Credits
This package was created with Cookiecutter from python-lsp/cookiecutter-pylsp-plugin project template.
Metadata
Release files for pylsp-rope 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylsp_rope-0.1.18.tar.gz | 21.9 kB | With provenance | Details for pylsp_rope-0.1.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pylsp_rope-0.1.18-py3-none-any.whl | Python 3 | none | any | Details for pylsp_rope-0.1.18-py3-none-any.whl |
Total release size: 36.1 kB
Release files / pylsp_rope-0.1.18.tar.gz
| Download URL | pylsp_rope-0.1.18.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cbca6f7a02d82b49c6efdbed1f2a933d751bba079c903c81732218622cf5380
|
|
BLAKE2b-256 checksum How to use checksums |
510cb9eac2b464d5fc106d4c45eac54d290aa298a70e37a23a7714354331f730
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / pylsp_rope-0.1.18-py3-none-any.whl
| Download URL | pylsp_rope-0.1.18-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bf1e25e8dcd228d8e1e94e7e17eb338a7ce6b5011d37b54d421febacc2a4077
|
|
BLAKE2b-256 checksum How to use checksums |
4efe9d9f676a81db293a1a2166e5bd82142d73d90b6e26739e8a0bc36532a973
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for pylsp-rope 0.1.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pylsp_rope-0.1.18.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.