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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparcli-0.1.3.tar.gz.
File metadata
- Download URL: sparcli-0.1.3.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Linux/5.0.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b421fc6c3c46ef548c9a4515324ceb831a4814eff4516ffda47822e824b90fb0
|
|
| MD5 |
ebf9490be55a7c09af35e86837e94d18
|
|
| BLAKE2b-256 |
647247b6cb63473c41134e5351f5902a1a5177bceb310ecdca5f926a43f1f171
|
File details
Details for the file sparcli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: sparcli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Linux/5.0.0-1031-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
615b15876986e455472044bb43e371eff47387fa91fcfa98c186ee1a37d542ab
|
|
| MD5 |
04ec1862df690a89e301d3200ebcaf4b
|
|
| BLAKE2b-256 |
cc7bd457f1e2797bd38db5ee6bc0a5a87bce3368358c7cae86d9a45d2d9ce300
|