Julia ide

My preferred Julia IDE after 3 months of coding.

Finding the perfect Julia IDE or a text editor is a matter of preference. There are quite a few options available.

In my first blog post about Julia, I listed all the options and mentioned that I will be using VS Code as the Julia IDE and Pluto interactive notebooks as my primary tools.

To keep things easy, for now, I decided to work with Julia using either Pluto interactive notebooks or VS Code with Julia extension, depending on the project. I am going to go over the installation of both options in detail in this post.

Me in May 2021

It turns out it was silly to decide on this before actually spending some time coding and getting a feel for each tool to develop a preference and polish the workflow.

What I use Julia for.

First, I’d like to give you some background on why I decided to learn JuliaLang. I began to learn Julia when I started my undergraduate summer research internship in May 2021 in one of the labs in our Physics department. Some projects this research group was working on were using Julia Language to perform complex and lengthy computations and simulations. Some computations take weeks to finish. Later, we will use Julia to utilize our GPU hardware to increase the computational power even more.

These are all the areas where Julia shines!

Jupyter Notebook vs VS Code.

When I first started learning Julia, I was unsure what IDE or text editor to use. There seemed to be so many options. It was challenging to settle on something particular and use it as an exclusive option.

As I began working on a project (this is essentially how I learned the language – learning by doing), I needed to collaborate with others. We worked on the same code. I was initially responsible for making it parallel and created two versions: multithreaded and distributed. Later I transitioned to work on the visualization part of thesimulation data. Folks were using Jupyter Notebook to write their code, and since the project was joint, so did I.

At that time, I was still trying to go back and forth between using Jupyter and VS Code. I should mention that I never used Jupyter before starting to learn Julia. Coming from coding in Python and MATLAB, I was more accustomed to working with IDEs rather than text editors.

And so VS Code felt familiar. It also provided a better error description and showed in which line of code the error was. My workflow was not very efficient. I would start writing in Jupyter when I get the error messages; If I could not understand which line of code raises this error, I would copy the code and paste it into the VS Code to try and debug it. After fixing things, I would copy the script back to Jupyter. Amateurish indeed!

VS Code and the integrated REPL terminal.

This is what my VS Code window looks like most of the time.

VS Code code pop-up documentation on hover is super convenient! TAB completion works excellently, too. Having two terminal windows open within the same editor window is hugely convenient: Julia REPL on the bottom left and the regular zsh (or whatever you use) on the bottom right.

I still use both VS Code and Jupyter. I’m hoping to switch to VS Code primarily one day. For some quick interactive checks of parts of the code, I could then use integrated Julia REPL. There are even keyboard shortcuts available from the editor in Julia REPL to execute parts of the code. This is described very well in this post.

Rediscovering Pluto Notebooks

So, what about Pluto? Initially, I did not like it. I was not fond of the syntax highlighting in particular, and the background colour of the notebook looked outdated to me. I still wish there was an easy way to change light and dark colour themes. Though the official documentation says it’s possible to change a theme, I have not been able to do so. At least not for any light-coloured theme. I was also missing a tools bar on the top of the notebook.

Over time, I developed a strong preference for writing everything in Jupyter. I like the interactivity, to be able to check each line of code right away. I even like the standard colour theme a lot! It is clean and modern, and it uses the Julia Language Logo colour theme, which I like so much;)

But then, some of the people on Twitter I respect a lot began to talk about how they love Pluto and its many valuable functionalities that Jupyter does not have. At the same time, I began working on the visualization part of my project. I was constantly annoyed by how small the plots were appearing in Jupyter:

Am I missing some obvious hack to make the plots show up larger?

It made it not practical to check something quickly when plotting. I started to search for alternatives. VS Code is not interactive enough, and plots in the plotting window were also not large enough to make out the little details in plotting when I would make some changes. I am aware of the option to use savefig() function to save the plots as an image, but again, the whole point is to be able to check the output quickly while writing the code before saving the final version of the plots.

As a last resort, I decided to give Pluto another try. Surprise, surprise! The plots were showing up within the notebook in the perfect size! Check this out.

The plot shows up full size above the code cell after you run it.

Another cool feature is to be able to make the plots themselves interactive. Changing a few parameters with the slider would change the plot in real-time.

You can find the code file on my GitHub profile here.

The magic of @bind macro.

The second biggest reason I like using Pluto is the interactive data cells. Say, if you have a function that outputs a multi-dimensional array, it’s very easy to follow the structure of the resulting data array.

Interactive Data Cells

I also enjoy the feature exclusive to the Pluto notebooks, which sets the namespace for the notebook to global. This means that changing a variable in one cell will automatically update it in the other cells. I.e. Pluto tracks dependencies between cells. Sometimes this may interfere with the quick exploration of parameters, as it will automatically re-run all the cells, depending on the cell you would like to change. If you do not want the other cells to run again, a new feature has been added recently that allows disabling some of the cells, preventing them from running.

Another super convenient feature is the live documentation, which can be seen in the video above on the bottom right. Works very much the same as the documentation pop-up on hover in the VS Code.

There have been claims from the Julia community members that Pluto is being developed to become a self-sufficient tool for production.

And lastly, maybe not necessarily related to the programming as such, but look at this beautiful blog post created with a Pluto Notebook!

The Julia REPL

Let’s not forget about the Julia REPL!

I still use it all the time when I quickly need to verify something. For example, testing how specific functions work and quickly constructing multi-dimensional arrays of needed size and structure. Doing some checks like this sometimes interferes with the namespace of the Puto notebook and throws errors. Therefore I like using the REPL for these tasks.

Conclusions

My workflow is constantly changing. More and more, I find myself using Pluto to write my Julia programs. Who knows, maybe one day, I’ll use it exclusively.

For now, my preferred Julia IDEs/editors are (in no particular order):

  • Pluto Notebooks
  • Jupyter Notebooks
  • Julia REPL
  • VS Code with Julia extension.
Quick update as of February 26, 2024.

I now exclusively use VS Code with Julia extension to write any Julia code. I would normally develop the code interactively in Jupyter Notebook inside the VS Code, and then, once everything is running correctly, I would make a   script_name.jl   file with the working version of the code.

4 thoughts on “My preferred Julia IDE after 3 months of coding.”

  1. > Am I missing some obvious hack to make the plots show up larger?

    You are probably using an out-dated version for Plots.jl and/or GR.jl.

  2. To change the default plot size in a Jupyter notebook, when using Plots.jl with the GR backend, I do this:

    Plots.gr(format=:png, size=(768,512), legend=false)

    before calling Plots.plot() or Plots.heatmap(), etc.

    You can set the size to something even larger if you want. I sometimes plot (or heatmap) data from very large arrays. I found that the default format (SVG, I think) resulted in very large notebook files. Setting the format to PNG solved this problem.

    Hope that helps you!

Leave a Comment

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