pysabelle.client package
Submodules
pysabelle.client.client module
High-level client that composes transport, dispatcher and raw commands.
- class pysabelle.client.client.IsabelleClient(transport, dispatcher, commands, *, server=None, default_timeout=60.0)[source]
Bases:
objectA connected Isabelle server client with command interface.
This class composes a
Transport, aTaskDispatcherand aRawCommandsinstance. It can manage its own server process or connect to an existing one.- Variables:
cmd (RawCommands) – The raw command interface. All server commands (help, echo, session_start, …) are available as methods on this object.
- Parameters:
transport (Transport)
dispatcher (TaskDispatcher)
commands (RawCommands)
server (IsabelleServerProcess | None)
default_timeout (float)
- async classmethod connect(host, port, password, *, _server=None)[source]
Connect to an already-running Isabelle server.
Performs the password handshake and returns a ready client.
- Parameters:
host (
str) – Server hostname or IP address.port (
int) – Server TCP port.password (
str) – Password obtained from the server’s startup message._server (
IsabelleServerProcess|None) – Internal use - server process manager if the client should also manage the server.
- Return type:
- Returns:
A connected IsabelleClient instance.
- Raises:
IsabelleConnectionError – If the handshake fails or the connection cannot be established.
- async classmethod start(name='isabelle', reuse_existing=True, server_env=None)[source]
Start a new Isabelle server (or reuse an existing one) and connect.
- Parameters:
name (
str) – Name of the server instance (as used by isabelle server).reuse_existing (
bool) – If True, attach to a running server with the given name instead of starting a new one.server_env (
dict[str,str] |None) – Environment for theisabelle serversubprocesses (default: inheritos.environ).
- Return type:
- Returns:
A connected IsabelleClient instance that owns the server process (unless reuse_existing attached to an existing server).
- Raises:
IsabelleServerError – If server startup fails.
IsabelleConnectionError – If the handshake fails.
- async stop_server()[source]
Stop the managed server process, if any.
Does nothing if the client does not own the server (e.g., attached via connect).
- Return type:
None
- async aclose()[source]
Release every resource: dispatcher, TCP connection and managed server.
Each step is attempted even if a previous one fails; the first error (if any) is re-raised at the end. The server is stopped in a worker thread because
isabelle server -xis a blocking subprocess call.- Return type:
None
Module contents
Client-level API: IsabelleClient and related types.