pythonimmediate.communicate module

class pythonimmediate.communicate.Communicator[source]

Bases: ABC

abstract send(data: bytes) None[source]

Send data. This function is called in the textopy part.

abstract static setup() tuple[Communicator, Callable[[], NoneType]][source]

Constructs an communicator object, that can be used to send information to this process.

The Communicator should be sent to the other process as part of the GlobalConfiguration object.

The ListenForwarder should be called in this process.

class pythonimmediate.communicate.GlobalConfiguration(debug: int = 0, communicator: Communicator = None, sanity_check_extra_line: bool = False, debug_force_buffered: bool = False, debug_log_communication: Optional[str] = None, naive_flush: bool = False)[source]

Bases: object

Represents the configuration.

This will be parsed from command-line argument in pytotex using from_args(), then sent to textopy side (which is where most of the processing is done) with a base64 of pickle encoding, on the textopy side a pseudo-config is created from the passed command-line arguments, then the real config is read in ParentProcessEngine’s constructor.

Which means it’s preferable to avoid any mutable state in the configuration object.

class pythonimmediate.communicate.MultiprocessingNetworkCommunicator(port: 'int', connection: 'Optional[Connection]' = None)[source]

Bases: Communicator

send(data: bytes) None[source]

Send data. This function is called in the textopy part.

static setup() tuple[MultiprocessingNetworkCommunicator, Callable[[], NoneType]][source]

Constructs an communicator object, that can be used to send information to this process.

The Communicator should be sent to the other process as part of the GlobalConfiguration object.

The ListenForwarder should be called in this process.

class pythonimmediate.communicate.UnnamedPipeCommunicator(pid: 'int', fileno: 'int', connection: 'Optional[IO[bytes]]' = None)[source]

Bases: Communicator

send(data: bytes) None[source]

Send data. This function is called in the textopy part.

static setup() tuple[UnnamedPipeCommunicator, Callable[[], NoneType]][source]

Constructs an communicator object, that can be used to send information to this process.

The Communicator should be sent to the other process as part of the GlobalConfiguration object.

The ListenForwarder should be called in this process.