Skip to content
01 Introduction

A really fun terminal experience

An extremely nano terminal experience for Python, built on ratatui.

Python / Open source / Cross platform

xnano

02Features

Composable

xnano is built on ratatui's layout and widget system, and provides an expressive API for composing the content displayed to the terminal.

A git client with a commit graph, branch tree and menus, drawn with xnano widgetsA git client with a commit graph, branch tree and menus, drawn with xnano widgets

Reactive

Create reactive components that respond to user input, time, and other factors at the speed you can think of them.

A small farming game running in the terminal with xnanoA small farming game running in the terminal with xnano

Audio Support

xnano treats audio content as a first-class citizen, with the ability to synthesize music with MIDI patterns, play back audio files, and capture microphone input. It can even generate sound effects in real time.

Pixel piano keys pressed as xnano plays their notesPixel piano keys pressed as xnano plays their notes

Effects

Anything on screen can dissolve, sweep, slide, fade or shift its colors with tachyonfx's effects, each started by name with placement.fx. Sounds take effects such as reverb and delay the same way.

Eight gradient cards in a grid, each playing in turn the tachyonfx effects named under it: dissolve and coalesce, sweeps, a hue shift, evolving symbols, slides, fades, paint and lightenEight gradient cards in a grid, each playing in turn the tachyonfx effects named under it: dissolve and coalesce, sweeps, a hue shift, evolving symbols, slides, fades, paint and lighten

AI Native

xnano.ai lets models read the canvas and answer in xnano values: choices, verdicts, text, pixel art, widgets and melodies, and gives any pydantic-ai agent tools to see and change it. Code a model writes runs in a sandbox that can draw on the canvas but cannot reach files, the network or the rest of your program.

A request for a now playing card typed into an xnano program, the program a model wrote for it shown beside the card it draws in the sandbox, then a second request that turns the card pinkA request for a now playing card typed into an xnano program, the program a model wrote for it shown beside the card it draws in the sandbox, then a second request that turns the card pink
03 Rhythm games

Four rhythm games. Each game is a program in examples/.

Each game keeps time with the clock of the canvas, reads the keyboard or the mouse, and plays its notes. Select a tab to watch a game.

A rhythm game in the terminal: numbered rings appear, a timing ring closes on each one, and each click on the beat scores A rhythm game in the terminal: numbered rings appear, a timing ring closes on each one, and each click on the beat scores

Click each ring as the timing ring closes on it. examples/01_rhythm_circles.py

04 In your browser

A program you can change and run on this page.

A canvas from xnano.new() draws into memory, so it needs no terminal. This program writes a sparkline and a gauge on a canvas, then prints the frame. It runs the same way in a terminal.

Editor (session: default)Run
import xnano
from xnano.styles import Style
from xnano.widgets import Gauge, Sparkline

requests = [3, 4, 6, 5, 7, 9, 8, 6, 7, 9, 10, 8, 6, 7] * 3
sparkline = Sparkline(requests, style=Style('cyan'))
gauge = Gauge(0.62, label='62% of 512 GB', gauge_style=Style('green'))

# a canvas draws in memory, so this runs in a terminal and in a browser
with xnano.new(width=44, height=7) as canvas:
    screen = canvas.screen
    screen.write('xnano', bold=True, foreground='magenta')
    screen.write('● online', x='right', y=0, foreground='green')
    screen.write(
        sparkline, width='100%', height=4, border='rounded', title='requests'
    )
    screen.write(gauge, width='100%', y='bottom')
    print(screen.render(format='ansi'))
OutputClear
Change the code, then press Run. The first run loads Python into this page. This takes a few seconds.
05 Explore