20 August 2022
While it might be tempting, resist the urge to use Jupyter Notebooks (/ Jupyter Lab) and use Julia in VS Code (with the Julia extension) instead. If you do only light analyses, consider Pluto.jl. If you need the cloud compute or don't want to install Julia, try JuliaHub.
If you use REPL a lot, look into combining it with tmux (see the previous article (#1)). It will allow you to "hide" your opened Julia REPL session.
It is not a fully-fledged replacement for an IDE, but it can help with a lot of quick tasks. You can use your "hidden" Julia REPL session as a quick-access super-powered calculator / Excel replacement / file scanner.
Try it:
Open your shell
Type tmux
and a new window will open
Type julia
to start Julia REPL and print something, eg, println("Hello!")
Now disconnect from this session by pressing CTRL+b
followed by d
, and your screen show disappear (/switch back to the previous shell window)
Type tmux a
and you should see your Julia session with "Hello" printed
Read more: Quick and Easy Guide to Tmux
Difficulty: Low
Downsides: None (except for the layer of complexity, I would suggest avoiding any window management)
The most modern and popular (seemingly) environment for Julia. It offers a modern IDE and a notebook-like experience if you want to combine both.
You must install the Julia VS Code extension is incredible! Read more here.
🔥🔥🔥 Nowadays, you can start a VS Code server from any remote machine and connect to it via your Github account. It's a similar experience to using VSCode on JuliaHub.
A few things that are worth configuring (Extensions - Julia - Extension Settings):
Pick your main shell (eg,"/bin/zsh" in "Julia > Persistent Session: Shell")
Enable persistent sessions with tmux under the hood ("Julia > Persistent Session: Enabled")
Other tips:
Invest time in learning some of the basic shortcuts to stay in the flow, eg, start with the ones that require lifting your hands from the keyboard and that you use often enough (eg, jumping between tabs, executing cells). Read some ideas here)
Split your screen and leverage the large vertical space for your data magic in Julia REPL
Consider installing Github Copilot. It works with Julia and can take out some of the repetitiveness and accidental syntactical mistakes
If you're used to (or curious about) Vim (explained below), download the VSCodeVim extension, which emulates Vim keybindings in VS Code
Difficulty: Low
Downsides: None
This is not for Julia beginners unless you're already familiar with it.
Vim is a highly configurable text editor. The main difference I see is that you operate not with arrow keys or a mouse but by executing "motions" that can perform incredibly complex tasks (and then you can easily repeat them).
It is my personal favourite and it has led to a significant boost in my productivity. But it requires a lot of setting up (a lot lot lot). Once you do, you will need 1-2 weeks to get used to it but then it becomes so enjoyable! It feels like playing a game while working - sometimes I make some changes, undo them and think about the best power combo to achieve the same.
I believe the trick is to combine the best of Vim and modern tools we have, eg, nvim+lua, use your mouse when it's faster, scroll with it (Neoscroll), don't use registers, etc. Basically, do things the way that is the most convenient / the fastest for YOU.
I'd recommend:
Precompile your LanguageServer.jl with Fredrikekre's great makefile
Nvim-treesitter to be able to select Julia loops or functions with one quick motion
Leap to jump anywhere in the texts
Vim-sandwitch to easily work with (),[],{},"", and others
LeaderF to quickly jump between files, buffers, etc.
Copilot-cmp to benefit from Github Copilot in Neovim
Other resources:
Vim+Julia on Discourse: Vim for newbies and Neovim and LanguageServer
My Nvim configuration (adapted from the amazing version by Jdhao)
Is it for you? Check out: Why I use Vim in 2022 and the first post in here or the gist of it: "Your problem is that you don't grok vi"
Difficulty: High
Downsides: Very steep learning curve. Not suitable to learn at the same time as Julia
The standard entry point via the Jupyter Notebook or Jupyter Lab experience. I have learned Python in it and I'm grateful for how easy it was, but Julia REPL + VS Code is much better.
It is still a good option if you're bound to big cloud platforms (eg, AWS Sagemaker Notebooks), but if you can look into VS Code Server. If you need both the compute (big cloud machines) and Julia, JuliaHub is the best option.
A few tips to make the transition easier:
Split your screen and give Julia REPL a lot of vertical space - you would see so much more than in an individual notebook cell
If you need to see some output from 2 steps ago, either:
Press Arrow up twice and execute it (takes 2 seconds, arguably faster than scrolling)
Use history search (CTRL+R) or TAB auto-completion to quickly find your commands. More on that in the next article.
You can also scroll in REPL...
If you miss the Table of Contents, remember that you now work with text - learn some shortcuts for quick searching and jumping around
If you don't want to lose the outputs of individual steps, or produce nice reports, look into Literate.jl or Quarto. I use both fairly regularly
Difficulty: Low
Downsides: Missing many perks of REPL and associated packages (eg, OhMyREPL, REPL special modes, REPL history)
I have listed only the options I have used a lot to have a basis for comparison, but there are many more.
Pluto are reactive notebooks (ie, re-evaluating on every "input" change). They are an incredible choice for quick interactive presentations, visualizations, and teaching.
If you have simple analyses (a single file) that don't take long and don't mind working with smaller code blocks (it operates on individual statements to be reactive), Pluto.jl is the best choice for you.
See: Pluto.jl and an amazing resource on building slides with Pluto.jl
It's strictly not an IDE. It's a cloud service from Julia Computing that allows you to spin up and down Pluto.jl notebooks, VS Code with arbitrary computing power.
If you don't want to install Julia on your computer, JuliaHub is the best choice.
I have met as many Julia users using Emacs as those using Neovim, so definitely a popular option. Somehow it tend to be people with Computer Science background.
See: Julia-emacs and julia-snail