Sync and async Python clients for the herdr Unix socket API. The package implements the canonical newline-delimited JSON protocol with no runtime dependencies.
Read the complete documentation at https://mariotaddeucci.github.io/herdr-client/.
It includes installation, configuration, Sync and Async examples, subscriptions, typed results, raw requests, errors and the generated API reference.
python -m pip install herdr-clientOr with uv:
uv add herdr-clientRequirements:
- Python 3.13 or newer.
- A running Herdr instance with an accessible Unix socket.
Synchronous:
from herdr_client import HerdrClient
client = HerdrClient()
print(client.ping())
print(client.workspace_list())Asynchronous:
import asyncio
from herdr_client import AsyncHerdrClient
async def main() -> None:
client = AsyncHerdrClient()
print(await client.ping())
print(await client.workspace_list())
asyncio.run(main())The package name is herdr-client; the import package is herdr_client.
Both clients expose the same operation names:
request(method, params)ping()workspace_list()tab_list(workspace_id=None)pane_list(workspace_id=None)pane_send_text(pane_id, text)pane_send_keys(pane_id, keys)pane_send_input(pane_id, text="", keys=None)pane_read(pane_id, source="recent", lines=80, strip_ansi=True, format=None)pane_wait_for_output(...)subscribe(subscriptions)
Return values are ordinary dictionaries with schema-derived TypedDict types. The
package includes py.typed for static type checkers.
Without an explicit socket_path, clients use this order:
session="name"in the constructor.HERDR_SOCKET_PATH.HERDR_SESSION=name.$HOME/.config/herdr/herdr.sock.
Named sessions use $HOME/.config/herdr/sessions/<name>/herdr.sock.
from pathlib import Path
from herdr_client import AsyncHerdrClient, HerdrClient
sync_client = HerdrClient(socket_path=Path("/run/user/1000/herdr.sock"))
async_client = AsyncHerdrClient(session="docs")The registry follows protocol 22 and contains 103 canonical JSON methods. Ten methods
have convenience wrappers: ping, workspace_list, tab_list, pane_list,
pane_send_text, pane_send_keys, pane_send_input, pane_read,
pane_wait_for_output and subscribe.
The remaining canonical methods have named stubs that raise NotImplementedError. Use
request() for a canonical method without a convenience wrapper. The hybrid
pane.graphics.stream transport is not implemented.
git clone https://github.com/mariotaddeucci/herdr-client.git
cd herdr-client
uv sync --all-groups
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run pyrefly check
uv run mkdocs build --strictThe default test command requires at least 90 percent coverage. Live integration tests are opt-in and require an explicitly configured Herdr socket.
Package releases are published when a GitHub release is created after PyPI Trusted Publishing is configured. The release tag must match the version detected from Git:
gh release create v0.1.0 --target main --generate-notesDocumentation deploys to GitHub Pages from main.
Apache License 2.0.