Skip to main content

Python bindings for the Rust graph library 'agg'

Project description

Asciinema Agg Python Bindings

This is a Python binding for agg which is a command line tool for converting asciinema recordings into GIF video files.

It requires a modified version of agg (by making some modules public), which is included in this repository at local_cargo_registry/agg.

Installation

From PyPI:

pip install agg-python-bindings

From GitHub:

pip install git+https://github.com/james4ever0/agg-python-bindings.git

Source install:

git clone https://github.com/james4ever0/agg-python-bindings.git
cd agg-python-bindings
pip install .

Usage

import agg_python_bindings

asciicast_filepath = "asciinema.cast"

# Load asciicast file from path, save terminal screenshots separated by frame_time_min_spacing (seconds) to png_write_dir
# Output png filename format: "{png_filename_prefix}_{screenshot_timestamp}.png"
agg_python_bindings.load_asciicast_and_save_png_screenshots(
    asciicast_filepath, # required, path to asciicast file (input)
    png_write_dir=".", # optional
    png_filename_prefix="screenshot", # optional
    frame_time_min_spacing=1.0 # optional
)

# Create a virtual terminal, feed string into it, then get states and take a screenshot
test_input = 'Hello from \x1B[1;3;31mxterm.js\x1B[0m $ '
screenshot_path = "terminal_screenshot.png"
terminal = agg_python_bindings.TerminalEmulator(80, 25)
changed = terminal.feed_str(test_input)
terminal_dump = terminal.text_raw()
cursor_states = terminal.get_cursor()
width, height, success = terminal.screenshot(screenshot_path)

# print a cybergod style terminal text dump with cursor
for index, it in enumerate(terminal_dump):
    if index == cursor_states[1]:
        it = it[:cursor_states[0]] +"<|cursor|>"+it[cursor_states[0]:]
    print(">", it)

Project details


Download files

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

Source Distribution

agg_python_bindings-0.1.4.tar.gz (85.1 kB view details)

Uploaded Source

Built Distributions

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

agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

File details

Details for the file agg_python_bindings-0.1.4.tar.gz.

File metadata

  • Download URL: agg_python_bindings-0.1.4.tar.gz
  • Upload date:
  • Size: 85.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.19

File hashes

Hashes for agg_python_bindings-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f09927eab546f69aa1b602c11481189a09a6f91f7179738a725cee66709cdd42
MD5 51f3387f677cba64d31d4dd6dd3c8fb3
BLAKE2b-256 957a41e3d2a0e250257d7c03d8e5b508e43db0a2b326b7f5d307ee718e44a1d4

See more details on using hashes here.

File details

Details for the file agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agg_python_bindings-0.1.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3f9a2ab279101267243f499603e1e57afcaae9778cf66e03b6e7670741a81a87
MD5 70808940c6ba79aaa158077e4454bec9
BLAKE2b-256 1b6e93896393a67550c38efe1dfb47af8fd7e9fe1f9738a882bc0eda54e1e69d

See more details on using hashes here.

File details

Details for the file agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agg_python_bindings-0.1.4-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e684a8c8ec74ac16f45666763ee4e73e3c17dd5defbd0f2ee63e8fec3f9b49c2
MD5 5f2731b0169039838be0be3748c586d6
BLAKE2b-256 d86e91be2682de6f7001035404cd3753da1a1ffdd0c513e3325c6cd07a68e9d1

See more details on using hashes here.

File details

Details for the file agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agg_python_bindings-0.1.4-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 002238b0e61bcd8900d2ac60cf9269e5a52a66cb0e1a7f18fe2b35ca04931cc8
MD5 7215c046435c25557ac1cb9cb1178fc1
BLAKE2b-256 86c76b48b65bab98cb98ee7321bee294204592abbb0abb84128480981e937a27

See more details on using hashes here.

File details

Details for the file agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agg_python_bindings-0.1.4-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ec1dd9d30e30c1e820389fdbd16b8e10754d419c1e555ef7c8527b274eb17305
MD5 5ee893102a08a2d48a013cb0d865ad4c
BLAKE2b-256 a31f63dee8efbdceda1f10f754d8ff5a75aee5e8f3ab1726c379bd1f1c5b45a8

See more details on using hashes here.

File details

Details for the file agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agg_python_bindings-0.1.4-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0507a5ccba48b7884b0399dc72025e392fe4fae8d652260d8f69ab4dcac695b4
MD5 a4d313a27d7c6269e30620758f1fcf44
BLAKE2b-256 0095618704b2e3d9be502e8c8b238d2c5f7618fc25e90c8716d11d15f2eaa78d

See more details on using hashes here.

Supported by

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