Feature Spotlight: Editing remote files

Happy Friday everyone!

In today’s blog post I’m going to cover a new feature recently appeared in PyCharm 4.5.x series: editing files directly on remote hosts. In a previous blog post, Feature Spotlight: Python remote development with PyCharm, I covered some basic principles of remote development using PyCharm: how to set up a remote interpreter for your project, vagrant box, VM, or even bare metal machine, and how to set up the deployment of your local project to the remote host. This post supplements the earlier one by focusing on editing files directly on remote hosts.

So let’s get started. At this point I assume you already have a remote host up and running, and the remote interpreter and deployment options properly configured in PyCharm.

At any time during development, you can go to Tools | Deployment | Browse Remote Host. This action will open the dedicated tool window for browsing remote files inside PyCharm:

remed1

In this window you can perform some common file operations, like renaming files and directories, changing permissions, copy/paste/delete, as well as creating new files and dirs. But what is most useful here is that you can open any file like you do in the project view:

remed2

See that special toolbar at the top of the editor? It tells you that the opened remote file hasn’t been changed yet. So let’s make some changes. Note that when you edit the file, PyCharm provides all the usual goodies like autocompletion, error-checking, quick-fixes, etc.:

remed3

When you’re done with changes, the toolbar indicates that the file has been changed and asks you if you want to upload it. Before the actual upload, you might want to compare the changed file with its previous state. Click  on the toolbar to inspect the diff:

remed4

You can revert your changes any time, by restoring the file to its previous uploaded version:

remed5

Finally, click  to upload your file.

I hope this feature makes your remote development even easier.

Have a nice weekend, and talk to you next week!
-Dmitry

About Dmitry Filippov

Product Marketing Manager at JetBrains
This entry was posted in Cool Feature. Bookmark the permalink.

12 Responses to Feature Spotlight: Editing remote files

  1. Даниил Водопьян says:

    Is it available in InteliJ IDEA? Is it going to be?

  2. Arefin says:

    Hi,

    Thanks for sharing important update of PyCharm. BTW, what is your PyCharm theme that you used for this blog? I really like the theme.

    Thanks,
    Arefin

  3. this is very handy, thanks a lot.

  4. Prateek Arroa says:

    Is it available in Pycharm Community edition ?

  5. Rob R says:

    Is there anyway to use the default theme/color scheme when editing a remote file?

    I just got Pycharm PE set up, and went to use one of the default dark themes like Monokai, and my first project I tried to connect to a remote Python interpreter. I opened a remote file to edit, and the colors looked off, definitely not what Monokai should look like. After trying it multiple times, and confirming my settings, I figured I would try doing a local project to see if that was the issue. Lo and behold it was, when I went to create/edit a file in a project using my local interpreter, the colors for the theme were normal.

    Is there a way to use the same theme with a project editing remote files/remote interpreter? Is it a setting I am missing to turn off using different colors with a remote proj?

    Thanks!

  6. Nathan Hunt says:

    I do get code completion for, e.g., variables that I define, but when I’m editing a remote file I don’t have code completion for libraries that I import. I have a remote interpreter set up, and when I use the Python console, I do have tab completion there. Is there something in my setup that I’m missing to get that same tab completion when editing a script?

    • Ernst Haagsman says:

      In this case it’s better to set up a deployment configuration to make sure your files are synchronized, you should get code completion only on your local files usually. You can set this up in Tools | Deployment | Configuration.

      • Nathan Hunt says:

        I don’t recall having changed anything since posting my comment above, but today I am actually getting code completion now on the files I access through browsing remote host. I’m not sure if something was still downloading so that PyCharm knew the contents of the libraries I was using? The only thing missing now is that if I do ctrl-Q for help on a function, I see the arguments that it accepts but not the docstring. Instead there’s this message: “You need configured Python SDK to render docstrings.” Is there a way to set this up to work with editing files using the method on this page?

Leave a Reply

Your email address will not be published. Required fields are marked *