pysabelle.server package
Submodules
pysabelle.server.exceptions module
Exceptions raised during server process management.
- exception pysabelle.server.exceptions.IsabelleServerError[source]
Bases:
IsabelleErrorBase class for errors raised by server process management.
- exception pysabelle.server.exceptions.ServerStartupTimeout[source]
Bases:
IsabelleServerErrorThe server did not emit its ready line within the configured timeout.
- exception pysabelle.server.exceptions.ServerAlreadyRunning[source]
Bases:
IsabelleServerErrorA server with the same name is already running.
- exception pysabelle.server.exceptions.ServerNotRunning[source]
Bases:
IsabelleServerErrorAn operation requiring a live server was invoked with none active.
pysabelle.server.models module
Data models for server information.
- class pysabelle.server.models.ServerInfo(name, host, port, password)[source]
Bases:
objectConnection information for a running Isabelle server.
- Variables:
name – Server name (as given with -n).
host – Hostname or IP address the server is listening on.
port – TCP port number.
password – Password required for the initial handshake.
- Parameters:
name (str)
host (str)
port (int)
password (str)
- name: str
- host: str
- port: int
- password: str
pysabelle.server.server_process module
Management of Isabelle server subprocesses.
- pysabelle.server.server_process.list_servers(isabelle_bin='isabelle', env=None)[source]
List all currently running Isabelle servers (
isabelle server -l).- Parameters:
isabelle_bin (
str) – Path or name of the isabelle executable.env (
dict[str,str] |None) – Environment for the subprocess (default: inherit). It determines$ISABELLE_HOME_USERand hence theservers.dbthat is consulted.
- Return type:
list[ServerInfo]- Returns:
List of ServerInfo objects for each running server.
- Raises:
IsabelleServerError – If the executable is missing or the command fails.
- pysabelle.server.server_process.is_server_running(name, isabelle_bin='isabelle', env=None)[source]
Check whether a server with the given name is currently running.
- Parameters:
name (
str) – Server name.isabelle_bin (
str) – Path or name of the isabelle executable.env (
dict[str,str] |None) – Environment for the subprocess (seelist_servers()).
- Return type:
bool- Returns:
True if a server with that name exists.
- class pysabelle.server.server_process.BaseIsabelleServer[source]
Bases:
ABCAbstract interface for Isabelle server lifecycle managers.
- abstract property is_running: bool
Trueif the server is currently active.
- abstract property info: ServerInfo
Connection details for the running server.
- Raises:
ServerNotRunning – If the server has not been started yet.
- class pysabelle.server.server_process.IsabelleServerProcess(name='isabelle', port=None, log_file=None, assume_existing=False, force_start=False, isabelle_bin='isabelle', startup_timeout=30.0, env=None)[source]
Bases:
BaseIsabelleServerManages an isabelle server subprocess.
This class can either spawn a new server, attach to an existing one, or replace a running server (force_start=True). It implements the context manager protocol.
- Parameters:
name (
str) – Server name (passed as -n).port (
int|None) – Optional specific port; if None, the OS assigns one.log_file (
str|Path|None) – Optional path to write server logs.assume_existing (
bool) – If True, do not start a new process; instead, attach to an already running server with the given name.force_start (
bool) – If True and a server with the same name is already running, stop it first and then start a fresh one.isabelle_bin (
str) – Path or name of the isabelle executable.startup_timeout (
float) – Maximum seconds to wait for the server to become ready.env (
dict[str,str] |None) – Environment for everyisabellesubprocess (spawn,-l,-x);Noneinheritsos.environ. Use it e.g. to select a differentISABELLE_HOME_USER.
- Raises:
ValueError – If both assume_existing and force_start are True.
- property is_running: bool
Check if the server process is still alive (by asking isabelle server -l).
- property info: ServerInfo
Connection information for the managed server.
- Raises:
ServerNotRunning – If start() has not been called yet.
- start()[source]
Start or attach to the server.
Behaviour depends on the constructor parameters: - assume_existing=True → attach to an existing server. - force_start=True → stop any existing server and start a new one. - otherwise → start a new server only if none is running.
- Return type:
- Returns:
Connection information of the server.
- Raises:
ServerAlreadyRunning – If a server is already running and neither assume_existing nor force_start are set.
ServerNotRunning – If assume_existing is True but no server is running.
ServerStartupTimeout – If the server does not become ready in time.
IsabelleServerError – For other process‑related errors.
Module contents
Server process management: starting, attaching, stopping Isabelle servers.
This package provides tools to control the lifecycle of isabelle server processes and to obtain connection information for running servers.