Skip to main content

Visualize metrics as text in real-time (sparklines)

Project description

Sparcli

Sparcli is a library for visualising metrics on the command line.

Use this library to see the shape of data during execution of data pipelines, simulators and other long-running programs. Each metric is displayed as a sparkline that updates as the data changes. Sparcli is thread-safe and non-blocking.

Build Publish Canary build

Usage

Sparcli is available on pypi:

pip install sparcli

You can wrap an iterable that produces scalars:

import sparcli, time

for y in sparcli.gen(ys, name="y"):
    do_something(y)

You can produce metrics using a context manager:

with sparcli.ctx() as ctx:
    for a, b in do_something_else():
        ctx.record(a=a, b=b)

You can also manage the context manually. Just don't forget to close it:

class MyMetricsPlugin:
    def start(self):
        self.ctx = sparcli.context()

    def callback(self, metrics: Dict[str, Real]):
        self.ctx.record(**metrics)

    def stop(self):
        self.ctx.close()

some_library.register_plugin(MyPlugin())

Development

pip install --user py-make poetry
poetry install
pymake all
poetry run python demo.py

Project details


Download files

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

Files for sparcli, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size sparcli-0.1.3-py3-none-any.whl (11.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sparcli-0.1.3.tar.gz (11.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page