27.16. Rope Integration

Optionally, you can install Rope, which provides Python code refactoring such as renaming and function extraction.

Once Rope is installed, the context menu in MATE includes the entry Refactoring, which opens a submenu with the entries Rename and Extract Function, depending on the current selection.

[Note]Note

For renaming to work properly, you need a workspace and an active project (see Section 27.11, “Project Workspaces”). The file where you want to rename something must be in the active project. Otherwise, renaming defaults to a string replacement.

[Note]Note

The renaming parses all files in the workspace, which may take some time depending on the number of files in that workspace.

[Tip]Tip

Rename and Extract Function take effect immediately; the changed files are saved, and the operation cannot be undone. Ensure you save the original files or store them in your source control system, such as SVN or Git.

27.16.1. Rename

When you select this entry, a dialog opens for entering the new name. After scanning your workspace, a window displays a DIFF view listing the files where strings will be renamed, along with the proposed changes in each file. You can then either press Perform Changes or Cancel to proceed or cancel the operation.

27.16.2. Extract Function

When you select this entry, a dialog opens for entering a name for the new function or method. You can then either press Yes or Cancel to proceed or cancel the operation.