Skip to main content

🖼️ ansi stdio

Terminal text composition and animation library.

$ uvx ansi_stdio

Tools

  • ansi-quantize - runs a program and quantizes its terminal output down to a frame rate. Char-level diffs courtesy of plansi and bittty.
  • ansi-fonts - lists available monospace fonts on the system.

Design

The thing is a scene graph made of Actor nodes. Each node has a clock and when rendered, can redirect calls. Haven't decided how child relationships and recursion will work yet, so keeping this open. Probably won't call them actors either.

Clocks are chained timers that can be paused and implement time however they like. clock.wall gives you the system time. Clock.time gives the current time etc.

Buffers are sparse grids of rich characters. They track their own size and can be merged (+= and +), queried/set (slice notation) and copied.

Object design

So far we have:

  • 🔢 Versioned - objects that are versioned have a version number that gets updated when they are changed.
  • 📦 Box - a 2d box, used for bounding things.
  • ⏲️ Clock - the workhorse of animation.

Still not figured out:

  • 💾 Saved - a serializable class.
  • 🎞️ The main actor class - is it a View?
  • How buffers, views and time work together with caching.
  • Should "Animation" be a buffer?

Overall plan

  • Build a custom video format with keyframes and delta frames/buffers. This can act as a cache and a rendering format. The encoder can then be used to capture terminal graphics from various sources, including text files, programs or other loaders.
  • Build serialization into the core objects via a generic mixin. The construction parameters will be attribute names by convention, so they can always be (de)serialized.
  • Once the foundations are laid, build in structure for working with a vast library of effects, sources and so on, and filtering it effectively. So we don't end up constrained, with everything dumped in a directory, and can compose the different things in various ways.
  • Make a plugin system for all these things.
  • Build a basic UI that works with this, somewhere between Kdenlive and OBS Studio.
  • Go to town building components that are useful. Idea being to use code generation within the confines of a decent structure, so using AI to add to it doesn't end up like a Glastonbury Festival toilet.

Next Steps

  • Finish the Saved class, figure out how it relates to Versioned.
  • Figure out animation buffers, how they map to buffers, accumulate and can be rendered.
  • Implement a recorder using the above.
  • Figure out how to convert ANSI text into animations when it has no timing info (callbacks that look for cursor movements and/or screen resets).
  • Start work on the UI

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansi_stdio-0.0.3.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansi_stdio-0.0.3-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file ansi_stdio-0.0.3.tar.gz.

File metadata

  • Download URL: ansi_stdio-0.0.3.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for ansi_stdio-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e8f91f4100e964cf89c36e01fabedd77c6462399189026c4fde22ddaade33253
MD5 a8c276e2caca7232d2bc24868a4dc69a
BLAKE2b-256 dfefee9179cc053ab5398cbc9b35eb1e5a8e8dcc78f32246753618fb50ebf66e

See more details on using hashes here.

File details

Details for the file ansi_stdio-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ansi_stdio-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for ansi_stdio-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 15360cf7f18f17e7039ec0fd50cf8e801f41a61c9d0655bd33b14e6a94587e2d
MD5 b4e8bee77522473682c2c48018d65860
BLAKE2b-256 7a8b91da87e516c43d12d95aa2a9d2eb2f619754c03160b0c1fe3fec87c37174

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page