Skip to main content

go-astty is modular process orchestration gate for seamless synchronous and asynchronous command-line executions in Python.

Project description

go-astty

go-astty or Gate of Asyncronous and Syncronous TTY, is a modular process orchestration gate for seamless synchronous and asynchronous command-line executions in Python.

go-astty decouples process lifecycle management from standard I/O streams by introducing structured, data-driven pipelines. By abstracting execution payload contexts into self-contained Object vectors, it shifts execution responsibility from external engine hooks directly into individual Task runtimes.

Architecture

The framework splits execution into two unified, object-oriented components:

  • Tasks (_BaseTask): Extended list containers acting as payload data vectors. They isolate the executable binary context, handle target system constraints via explicit pre-runtime structural gates (validation), and natively invoke their own execution cycles via .run().
  • Pipers (_BasePiper): Isolated state engines tied directly to specific task envelopes to capture and track operational boundaries (stdin, stdout, stderr, paths, and exit return codes).

Features

  • Self-Contained Runtimes: Tasks are no longer passive configuration blocks passed to functional routines; execution logic is encapsulated directly within the task objects (task.run()).
  • Pre-Runtime Validation Gates: Safe assertion tracks (shutil.which) evaluate process structure and binary integrity before booting processes to enforce immediate fail-fast mechanics.
  • Dual Object Engine Layout: Mirrored execution architectures separating blocking synchronous behaviors (syncrun.SyncTask) and non-blocking asynchronous event routines (asyncrun.AsyncTask) cleanly under a predictable interface.

Installation

To install directly from the source repository:

Clone from Codeberg:

git clone https://codeberg.org/Fyllus/go-astty.git

Clone from GitHub:

git clone https://github.com/fyllus/go-astty.git

Install:

cd goastty
pip install .

Usage Guide

1. Asynchronous Execution Pipeline

Perfect for long-running CLI integrations, microservices, or concurrent network-bound stream tracking.

import asyncio
from pathlib import Path
from goastty import asyncrun

async def main():
    # Instantiate asynchronous task with payload arguments
    task = asyncrun.AsyncTask("ping", "-c", "5", "google.com")
    task.piper.path = Path.home()
    
    # Fire the self-contained non-blocking runtime
    await task.run()
    
    # Evaluate context matrices safely
    if task.piper.returncode == 0:
        print(task.piper.stdout.decode("utf-8"))
    else:
        print(f"Error: {task.piper.stderr.decode('utf-8')}")

if __name__ == "__main__":
    asyncio.run(main())

2. Synchronous Execution Pipeline

Ideal for local scripts, standard automation sequences, or linear operational pipelines.

from pathlib import Path
from goastty import syncrun

def run_backup():
    # Build standard array configuration payload
    task = syncrun.SyncTask("tar", "-czf", "backup.tar.gz", "src/")
    task.piper.path = Path.cwd()
    
    # Invoke execution directly from the task payload instance
    task.run()
    
    print(f"Process finalized with code: {task.piper.returncode}")

if __name__ == "__main__":
    run_backup()

API Specification

Core Classes

_BasePiper

The logical data matrix tracking standard streams and execution boundaries.

  • stdout / stderr: Automatic validation and mutation of incremental stream chunks (bytearray).
  • returncode: Tracking vector for process termination status.
  • path: Explicit execution context location directory (pathlib.Path).
  • shell: Evaluates whether execution requires a target environment shell gateway.

_BaseTask(list)

An extended list structure executing process payload vectors.

  • prog: Tracks the execution binary anchor context (self[0]).
  • args: Slices away argument payloads safely (self[1:]).
  • validation(): Evaluates process layout constraints and structural target command existence before booting.
  • run(stdin=None, kwargs): Abstract gateway implemented by runtime engines to drive process setups natively.

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

go_astty-0.1.0a0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

go_astty-0.1.0a0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file go_astty-0.1.0a0.tar.gz.

File metadata

  • Download URL: go_astty-0.1.0a0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for go_astty-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 d16b195ff572c7d649db982b00cdf1da3924cb0f06b90e1e3858352e846d579d
MD5 c4f52fc7d22c2e2fa755aa3814669031
BLAKE2b-256 11cb494e225ab7989e3846644f925bfe12a33bdb2999ea0a7b22f1e66c704d2a

See more details on using hashes here.

File details

Details for the file go_astty-0.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: go_astty-0.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for go_astty-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bdbe7dadc03841d5bd455acae9ac4b67a6f203f6ac4daab8a6697a0a3f57116
MD5 dc97661d05f12f3f70bf994c8e4e9ffd
BLAKE2b-256 87d9ce8cfd0412e3a19d3ac1c11dee9748228a7ba00a44bb3316f5220309f65e

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