Skip to content

thehappycheese/uiua_kernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uiua Kernel

IPython Kernel for the Uiua programming language, crudely implemented as a python wrapper.

This is an experimental repo, and not currently part of the official Uiua project.

Screenshot

1. Usage / Development instructions

This repo is not ready for general use, although it does work, so only development instructions are provided; It requires that Rust and Cargo and Uiua have already been installed

git clone # ... url for this repo
cd # ... path to this repo
pip install -e .
jupyter kernelspec install ".\src\uiua_kernel" --user --log-level DEBUG 

2. Implementation Notes

2.1. Formatting

A Jupyter Kernel apparently cannot offer to format cell contents. This is still a language server feature, and it is not clear if it can be triggered on cell execution, like Uiua pad

2.2. Color Of Output

I messed around with the python package ansi2html but I'm pretty sure the colour codes just aren't in the output. Maybe they are there but they are getting lost somehow in the mysterious machinery of subprocess.Popen.

I think uiua eval detects if it is running in an interactive terminal, and if not, it does not appear to output ansi colour codes. The eval command offers a --no-color flag, but maybe it should also offer a --always-color flag or something.

2.3. Large Output; Sounds and Images

Currently this seems impossible; uiua eval can only output a formatted text stream.

The jupyter kernel apparently requires image data in a base64 encoded format. Perhaps uiua could output a JSON-formatted output to facilitate appropriate output rendering.

2.4. uiua repl vs uiua eval

I did not try to connect this kernel wrapper to uiua repl. The repl also does not maintain the state of the stack between calls, so I am not sure if there is any reason to try?

3. Future Direction

It seems to me like the best way forward is to implement the kernel directly in rust, this would be much easier than maintaining this python wrapper. The zmq crate and the jupyter docs are a good place to start, also a good example to work from might be the evcxr is basically a jupyter kernel for the rust programming language itself (Insane, I know, but its very cool).

4. See Also

About

IPython kernel for Uiua crudley implemented using a python wrapper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published