Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm code inspection with remote interpreter

Tags:

I am using PyCharm professional edition 2018.1 I am using remote interpreter via ssh. As a result, when I use shortcuts to Inspect Code (e.g. look at the source of a function I am using in the main script), the tab that opens refers to a file on the remote server /system/remote_resources/.../...

This is quite annoying because this is not the file I need to modify, since it is just a temporary copy of the local file and it already happened to me to modify the remote file, which has no effect on the execution.

Is there a way for PyCharm code inspection to open the local script, rather than the remote copy?

This is how I configure the ssh connection. No path mappings are set.

enter image description here

like image 227
FLab Avatar asked Jul 11 '18 11:07

FLab


People also ask

How do I inspect code in PyCharm?

From the main menu, select Code | Analyze Code | Run Inspection by Name… or press Ctrl+Alt+Shift+I .

Does PyCharm have Linting?

PyCharm integrates with ESLint which brings a wide range of linting rules that can also be extended with plugins. PyCharm shows warnings and errors reported by ESLint right in the editor, as you type. With ESLint, you can also use JavaScript Standard Style as well as lint your TypeScript code.


1 Answers

You need to specify path mappings for particular run configuration or interpreter. After that your local files will point to the remote ones. E.g. /User/local/project= /User/remote/project

Path mappings for the interpreter:

Pycharm > Preferences > Project > Project Interpreter > Click on Project

enter image description here

Path mappings for run configurations:

Run > Edit configuration > Choose run cofig > Choose remote interperter > Fill in mappings

enter image description here

Just to be clear it will still cache some files: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206593675-Path-Mappings-does-not-work-for-me

like image 200
Nuts Avatar answered Jan 04 '23 05:01

Nuts