I used to code in VSCode (a.k.a., “VSC”), but it got bloated with each update and some of my configs broke. Also, Jupyter Notebooks is kinda slow on VSC. At the same time, I got introduced to Julia’s Revise package which auto-compiles Julia packages as you edit them. This can be useful for REPL Driven Development where you interact with a live code. I have some concerns about this programming style, esp. when data is mutable in the language (maybe that is why Clojure benefits from REPL DD because Clojure data are immutable). That said, REPL DD is quite enjoyable, fast, and—if you are careful—safe. I wanted to have REPL DD in Python too, and unfortunately there is no official support for this.
That said, I found out that something similar to REPL DD can be done in Python as well. Here is how:
First off, I now write my code in a text editor, not and IDE like VSC, PyCharm, Spider, etc. Multiple text editors are available:
Obviously, something that supports syntax highlighting, indentation, etc. is preferred. Vim does not do that out-of-the-box, but plugins take care of that. LunarVim seems to have this feature by default.
I use Kitty in quake-mode for dirty on-off scripts and iTerm2 as the main terminal in which I open REPLs. My favorite shell is zsh, but I hear good things about Fish too.
OPTION-SPACE
to toggle iTerm2 and CTRL-SPACE
to toggle Kitty. Also, I have set a “floating window” profile for iTerm2 so that it stays on top of all windows. I can hide it by pressing its keybinding again.Go to the project directory and activate the required Conda environment. I have assigned this alias to make things a bit easier:
,ca paper-1
which activates paper-1
, the Conda environment for my first XAI paper. Then, I simply open IPython: