Skip to main content

Local-or-remote host abstraction for optio task types (run commands local or remote, transfer files, tunnels).

Project description

optio-host

Local-or-remote host abstraction for optio task types. The agent-coordination protocol that used to live here now lives in optio-agents.

optio-host lets a task author run shell commands, manage workdirs, and stream files without caring whether the work happens locally or on a remote host over SSH.

What's in the box

  • Host Protocol + LocalHost / RemoteHost / make_host() — uniform interface for running commands, opening port forwards, transferring files, and tearing down workdirs. SSH details (auth, multiplexing, channel cleanup) are hidden behind asyncssh.
  • RunResult / HostCommandError — the result and error types produced by Host.run_command.
  • create_download_task(...) — a ready-made optio task that downloads a file from a remote host with progress reporting and integrity checks.
  • For the log/deliverables coordination protocol, the keyword parser, and HookContext, see optio-agents.

When to use it

You're building an optio task type that needs to run work on a host — local or remote — and you want:

  • one abstraction that works in both modes,
  • a structured way for the running process to talk back to optio (progress + deliverables) — see optio-agents,
  • SSH transport handled for you.

If you're writing the end-user task type directly (not consuming this library from another optio task package), you probably want optio-core instead.

Installation

pip install optio-host

optio-host depends on optio-core and asyncssh. Python 3.11+.

Minimal example

from optio_host import make_host, SSHConfig

# Local
async with make_host(ssh=None) as host:
    result = await host.run(["uname", "-a"])
    print(result.stdout)

# Remote
ssh = SSHConfig(host="worker-1", user="optio", key_path="~/.ssh/id_optio")
async with make_host(ssh=ssh) as host:
    result = await host.run(["uname", "-a"])
    print(result.stdout)

License

Apache-2.0.

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

optio_host-0.2.4.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

optio_host-0.2.4-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file optio_host-0.2.4.tar.gz.

File metadata

  • Download URL: optio_host-0.2.4.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optio_host-0.2.4.tar.gz
Algorithm Hash digest
SHA256 cb3b4d2149ec3aea11a65f8ba142209e2768d7af3b13d62d0cf0afd1176bd66a
MD5 795a9d66d9f2469fb9e9f6d7c356c156
BLAKE2b-256 5efe4124b197cc655cdaaa30cb1e2574558b72668d3ac9f963963a0808750e63

See more details on using hashes here.

File details

Details for the file optio_host-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: optio_host-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for optio_host-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d076be8f0f3b414ae1f0da6f8d17a5e1ad68169379e1b4d16358739df1407abd
MD5 19b270d4bcbafb27290633f89f2909c8
BLAKE2b-256 bf413cc29036fd175f5d865adc4fa0c4d8faa2837c81b930f03a8688a64bde1d

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