Skip to content

Module bastionlab.client

Classes

Client(channel: grpc.Channel, signing_key: bastionlab.keys.SigningKey)

The Client class provides access to the BastionLab machine learning platform through several attributes.

Initializes the client with a gRPC channel to the BastionLab server.

Class variables

signing_key: Optional[bastionlab.keys.SigningKey]
Signing key used

Instance variables

polars: bastionlab.polars.BastionLabPolars
The BastionLabPolars instance used by this client.
tokenizers: bastionlab.tokenizers.BastionLabTokenizers
Returns the BastionLabTokenizers instance used by this client.
torch: bastionlab.torch.BastionLabTorch
The BastionLabTorch instance used by this client.
Connection(host: str, port: int = 50056, identity: Optional[bastionlab.keys.SigningKey] = None)

This class represents a connection to a remote server. It holds the necessary information to establish and manage the connection, such as the hostname, port, identity (signing key), and token (if applicable).

Class variables

channel: Optional[grpc.Channel]
The underlying gRPC channel.
host: str
The hostname or IP address of the remote server.
identity: Optional[bastionlab.keys.SigningKey]
The signing key to use for authentication. If not provided, the connection will not be authenticated.
port: int
The port to use for the connection. Defaults to 50056.

Instance variables

client: bastionlab.client.Client
Returns a Client instance that provides access to the BastionLab machine learning platform.

Methods

__exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) ‑> None
Closes the connection to the server and cleans up any resources being used by the Client object. This method is called automatically when the with statement is exited. Args: exc_type: The type of the exception that caused the with statement to exit. exc_value: The value of the exception that caused the with statement to exit. exc_traceback: The traceback of the exception that caused the with statement to exit.
close(self)

Closes the connection to the server.

This method is equivalent to calling __exit__ directly, but provides a more intuitive and readable way to close the connection.