mxcubecore.ipc.models

Pydantic envelope models for the mxcubecore IPC wire format.

See IPC_FORMAT.md for the full wire format description. The envelope is JSON-RPC 2.0 shaped and shared verbatim by both transports (JSON-RPC/TCP and NanoMQ) so the core dispatch logic in mxcubecore.ipc.server never has to know which transport carried a message.

Classes

IPCError(*, code, message[, data])

Error payload carried in an IPCErrorResponse.

IPCErrorResponse(*[, jsonrpc, id])

Error reply to an IPCRequest.

IPCEvent(*, jsonrpc, method, params, ...)

A server-initiated notification (no id, no reply expected).

IPCRequest(*, jsonrpc, id, method, params, ...)

A command sent by the client to invoke one whitelisted method.

IPCResponse(*[, jsonrpc, result])

Successful reply to an IPCRequest.

class mxcubecore.ipc.models.IPCError(*, code: int, message: str, data: Any | None = None)[source]

Bases: BaseModel

Error payload carried in an IPCErrorResponse.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.ipc.models.IPCErrorResponse(*, jsonrpc: Literal['2.0'] = '2.0', id: str | int | None = None, error: IPCError)[source]

Bases: _JsonRpc

Error reply to an IPCRequest.

id is None when the request’s id couldn’t be determined (e.g. parse error).

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.ipc.models.IPCEvent(*, jsonrpc: ~typing.Literal['2.0'] = '2.0', method: str, params: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: _JsonRpc

A server-initiated notification (no id, no reply expected).

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.ipc.models.IPCRequest(*, jsonrpc: ~typing.Literal['2.0'] = '2.0', id: str | int, method: str, params: ~typing.Dict[str, ~typing.Any] = <factory>)[source]

Bases: _JsonRpc

A command sent by the client to invoke one whitelisted method.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class mxcubecore.ipc.models.IPCResponse(*, jsonrpc: Literal['2.0'] = '2.0', id: str | int, result: Any = None)[source]

Bases: _JsonRpc

Successful reply to an IPCRequest.

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].