Skip to main content

await-able Python REPL

In Interactive Consoles/REPLs of Python, I wrote about some pains with dropping into a useable REPL from anywhere in my code. Hoping code.interact() would just work failed me, so I started down the path of writing a simple REPL that would allow me to copy/paste arbitrary python code (including code with multi-line pastes).

I even went as far as developing an await-able version, but it was really only a synchronous function masquerading as an async function. And to make matters worse, we still could not await in the REPL itself.

All things to fix now!

Interactive Consoles/REPLs of Python

Recently I've been developing some debugging utilities in python. Due to a number of desires to have multiple ways of interfacing with these tools, I've gone down a number of rabbit holes in how the internals of Python work. One such rabbit how is in regards to the interactive console or REPL. Note: REPL is a "read-eval_exec-print loop". I use console and REPL interchangeably.

As most know, when you start python without any parameters it drops into a interactive console:

Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

When you type a (single-line) command in the terminal, it completes.

>>> print("text here")
text here
>>>

Now, the print("text here") code above is considered a complete block (or a complete expression). Python was able to confidently assume that your command was complete and it could be run. But what if we're doing a multi-line function?

>>> def func():
... print("first")
... print("second")
...

The console will change the prompt to indicate that there is a continuance of the current python code block. The console will not run until it can assume that you are done with your code block. This assumption is based on the empty line at the end. Ok, great, but what about functions that have newlines in the middle of them? For example, what happens if you copy the following into an interactive python console? For example:

def func():
print("first")

print("second")

Magic!

SSH Noise: Not a socket.

Overview

For awhile now, but not always, I've been getting chan_shutdown_read: channel 1: shutdown() failed for fd 7 [i0 o0]: Not a socket on my terminal whenever I do something with SSH. This include ssh, scp, and git commands. It'll often obscure the password prompt at the bottom of the terminal screen.

Managing Neovim Dependencies

Overview

Been using neovim more in recent months. I think its a great replacement for vim, but it suffers greatly because all its modern bells and whistles also require an internet connection. I'm not a fan of this. To make matters worse, it has a great many external dependencies.

Shared Python States & REPL

Overview

Code snippet of 3 python files:

  • EnhancedConsole - a simple extension of InteractiveConsole for hosting REPL in server and client code.
  • Server - A simple example of using multiprocessing.managers over Unix sockets and running with a REPL.
  • Client - A simple exmaple of using multiprocessing.managers (as a client) over Unix sockers and running with a REPL.

Desktop Managers are overrated.

Overview

In one particular network, I went through a long adventure of troubleshooting random reboots. I still haven't solved the problem, but I have gotten things to a stable state and I wanted to share everything I can recall from this nonsense situation. Gist: It involves power management and getting rid of all desktop managers without effecting usability or workflow.

Partial JSON Parsing

Overview

I had a need to parse only the beginning preview of a set of large JSON files (e.g. safetensors). I wanted the ability to parse this JSON, to:

  1. Know that everything up to the cut off was valid JSON.
  2. Be able to process the JSON for beautification or header processing.

Alas, most json libraries do want the whole JSON. After a bit of work, I was able to get it going with ijson.

Portable Tmux & Neovim

Overview

As of late, I've been attempting to catch up with the flurry of new developer tools that now exists. Many of the TUI tools are golang or rust and therefore have nice portable static versions. This means one single binary that has all the things I need to use the tool. It goes in my ~/.local/bin and that is that (presuming you aren't ricing in catppuccin).

Now tmux and nvim are central to all of this portability and yet they remain relatively non-portable and are themselves written in C and C++ respectively. I'd like to fix this.

IPv4 Preferred Over IPv6

Overview

Lots of network applications stopped working in my developer virtual machine but would work within containers on the same VM. The network stack was working, the firewall didn't look weird ... what the heck?

NeoVim is Meh

Overview

Recently I decided to revisit some of my staple habits and tools for development. This included the question, "What is the new generation using for console text editing?". I was under the naive perception that most are using nano because most are likely using a GUI IDE like VSCode or XCode as their work horse and there is little reason to bother with the likes of emacs and vim anymore. Apparently, this was grossly wrong ...