Skip to main content

Thin Python client for the pupptyeer daemon (NDJSON over a unix socket).

Project description

pupptyeer-client

Thin Python client for the pupptyeer daemon: NDJSON over a unix socket, standard library only (no dependencies).

pupptyeer is a local daemon that owns persistent PTY sessions. This client talks to it over the daemon's unix socket; it does not start the daemon. Install and run the daemon separately (see the main README), or npm i -g pupptyeer for the prebuilt binary.

Install

pip install pupptyeer-client

Requires Python >= 3.8.

Usage

import os, sys
from pupptyeer_client import PupptyeerClient

# Connect to the daemon's unix socket (the daemon exports its path via $PUPPTYEER_SOCK).
c = PupptyeerClient.connect(os.environ["PUPPTYEER_SOCK"])

# Spawn a command in a fresh PTY; get back a session id.
sid = c.new_session(command="bash", cols=80, rows=24)

# Stream the session's live output, then attach this connection.
c.on_output(sid, lambda b: sys.stdout.buffer.write(b))
c.attach(sid, cols=80, rows=24)

# Drive it.
c.write_pane(sid, "echo hello\n")

# Read the daemon's authoritative rendered screen once the PTY goes quiet.
screen = c.capture_screen(sid, settle_ms=50)
print("\n".join(screen.lines))

c.close()  # sessions outlive the client

See the protocol spec for the full verb set (new_session, list_sessions, attach/detach, write_pane, capture_pane, resize, kill, gc).

License

MIT

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

pupptyeer_client-0.5.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

pupptyeer_client-0.5.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pupptyeer_client-0.5.1.tar.gz.

File metadata

  • Download URL: pupptyeer_client-0.5.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pupptyeer_client-0.5.1.tar.gz
Algorithm Hash digest
SHA256 618f468a66fa07e95b0bb4d89e28899213cf0278ce0cb53498225c9fe241e9c5
MD5 7b994de3112c0c3675dff08939b8d32c
BLAKE2b-256 633def76cf0d10dbc234cb63e59c01b0186bd09b0c7af2cd2a13fa050931c826

See more details on using hashes here.

Provenance

The following attestation bundles were made for pupptyeer_client-0.5.1.tar.gz:

Publisher: release.yml on PeterSR/pupptyeer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pupptyeer_client-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pupptyeer_client-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35bc5843f5e55fbc4dd429bbad4c12fc49879fce48830e983f30544d253ad39f
MD5 35a9ee3b315b2cdff6753248c68d6f37
BLAKE2b-256 48b542c193a8b828c352222371d477cf0647267ec1f9289dcb84c2682f20ede4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pupptyeer_client-0.5.1-py3-none-any.whl:

Publisher: release.yml on PeterSR/pupptyeer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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