Remote Development with Pycharm
Pycharm, for me, is a great IDE — complete with features that promote productive programming, a community devoted to sharing clever plug-ins, and, my personal favorite trait, Professional licenses are free to students. With this, JetBrains toolbox with its many IDEs (one for most modern computing language) is available to students free of charge (no strings attached). Bravo, JetBrains! Free for students is a service that more products should embrace.
With that, let’s move on to the point — working remotely via PyCharm.
With the Coronavirus now an international concern, a vast percentage of professionals must work remotely (myself included). As I set up an iMac (i.e., local machine) to work in sync with a PC running Ubuntu (i.e., remote host), the next step is to configure PyCharm to edit locally and run remotely. There are many reasons one may want to do this — my motivation is to easily deploy jobs to the remote host with GPUs. This is not the first time I have stepped through this process — each time having to recall how it is done. For this, I figured it was worth taking notes and sharing on Medium. Enjoy!
Set up a Remote Host
Setting up a Remote Host via PyCharm’s Deployment tools is quite simple (i.e., as most features offered by PyCharm tend to be). For this, a few words would suffice. Nonetheless, prepared in this tutorial are detailed steps to ensure clarity. Let’s begin!
Specifically, we aim to set an SFTP connection, which is a secure file transfer schema that runs over SSH protocol. For this, we must know
- The IP address of the host, which is accessible via the ifconfig bash command.
- The username on the host (at the respective IP address from (1))
- The password or an SSH key (for simplicity, the password will be used here — future blog could be on SSH keys).
Now, with knowledge of 1–3, we configure PyCharm on the local machine.
From there, gifs are worth 1,000 words:
Now, changes can automatically upload as shown in the following view.
Notice that now the Automatic Upload (always) option is checked off.
Alternatively, there are various ways to handle synchronization manually.
Voilà! Just like that, we are all set up to work remotely!
To be fair, the following should be noted: Pycharm is a personal preference that made the most sense when transitioning from MATLAB back in 2016 (i.e., similar look-and-feel). With that being said, there are other promising alternatives that others (seemingly rightfully so) may argue are better (e.g., Atom, Visual Studio, Spyder, amongst others). See the 11 Best Python IDEs in 2020 per Guru99 — and no, I did not pick this list just because Pycharm is listed #1 ;) Feel free to share your favorite IDE in the comments below.
One final note —I spent many hours learning PyCharm, for it is a tool I use daily. So, is it worth learning a new tool to boost productivity? In my opinion, it is not only worth it, but it is imperative — vim, emacs, etc., are great for quick access to remote files; however, it is 2020, people, let’s use the technology at our disposal ;)
At the same time, tools like PyCharm hide many fundamental concepts under the hood: junior researchers, do not compromise a deep understanding for a few minutes saved. In other words, do not learn the ins-and-outs of PyCharm, unless the basics of Python is known and an intermediate understanding is being learned in parallel. Else, come the day a powerful graphical interface like PyCharm is not an option, one must certainly be able to still perform (trust me, if this is not obvious to you then that means you probably should learn the basics of structuring python projects and systems paths). Here listed are a few other blogs that could be worth the read:
- How to Structure a Python Project, by Misha Berrien.
- 10 Steps to Set Up Your Python Project for Success, by Jeff Hale.
- Cookie-cutters to learn and build on — worked well for me in the past.
In any case, there is a ton of information available on the topics hinted at above, so if the answer you seek is not in one or more of the references provided, then do not hesitate to comment and a link will be provided (if there is no link, then a blog will be created — scout’s honor).
I hope this was helpful. Do comment suggestions or questions on this or future topics that should be covered! Furthermore, if there is anything in particular that worked well (e.g., the usage of gifs versus text and images) or not (e.g., too few details) please let me know for the sake of updating this and, moreover, for me to take into consideration when building future blogs.
Thank you for reading :)