Marimo - a great new tool for building micro- & internal apps

Marimo - a great new tool for building micro- & internal apps

Table of Contents

Introduction to Marimo

I’m a huge fan of Marimo - a next generation Python “notebook” which, like predecessors such as Jupyter & Hex, provide a useful paradigm that’s more reusable than a script but has great REPL-like interactivity.

I gave a talk in 2020 about using Jupyter Notebooks beyond data science , such as in DevOps and QA - so Marimo has absolutely captured my attention.

Here’s my pitch:

Imagine that with the effort it takes to create a Jupyter notebook or write a Python script, with minimal extra effort you also get:
- a “mini app” that runs as a gui OR runs as a script you trigger via CLI OR as a notebook
- that runs either locally or hosted on the web
- is equally happy to run with a human in the loop OR work fully automatically (such as in CI/CD)

Later, I intend to show my light wrapper (“Rifleman”) that makes the above easier, and also:

  • adds itself to a browse/search engine experience enabling other people to discover it (i.e. semantic search for the use case itself)
  • enables us to host Beta features for end clients and prospects
  • rapidly create bespoke demos for prospects/clients in a Forward-Deployed Engineering style, as made famous by Palantir

Run your code 3 different ways

Go here, right now: https://github.com/paulkarayan/marimo-tricks/blob/main/secrets_manager.py

Check out this simple implementation of a util to work with AWS Secrets Manager secrets. It’s pretty easy to extend it to be useful, but I really want you to see this:

# you can use the notebook gui:
> marimo edit secrets_manager.py 

# or the web app
> marimo run secrets_manager.py 

# or use the cli:
> python secrets_manager.py -- --secret_name gas-service/METHANE_API_KEY --secret_string 'IamGrosNain'

Here are some pretty pictures, but it’s actually got some great UI Elements: Marimo CLI Marimo GUI

BASHing up the Marimo

I really missed the magic method to run commands in the terminal, but if you read the code above, you can see a hacky way to do it in Marimo:

@app.cell
def __():
    import subprocess
    import marimo as mo

    def bash(command):
        result = subprocess.run(command, shell=True, capture_output=True, text=True)
        return result.stdout.strip()
    return bash, mo, subprocess

Conclusion

I can’t wait to see what the Marimo team comes up with next. Really useful stuff and I’m already a big fan. Maybe I can use it on some of the ideas I had for Jupyter in 2020 that just didn’t have the tech quite ready for it?

Let me know what other things you think we could build with this - happy to hack on stuff together!

Related Posts

Extract just the Accordion out of a song / mix

Extract just the Accordion out of a song / mix

update This is an even better version using Moises’ more expensive tier for a lovely Horace Trahan tune: https://www.

Read More
Aliases I have known and loved

Aliases I have known and loved

At the core of my development is VSCode, iterm2, and zsh.

Read More

Get new posts via email

Intuit Mailchimp

Copyright 2024-infinity, Paul Pereyda Karayan. Design by Zeon Studio