API#
Here: server classes#
- async herethere.here.start_server(config: ~herethere.here.config.ServerConfig, namespace: dict = None, server_factory: type[~herethere.here.server.SSHServerHere] = <class 'herethere.here.server.SSHServerHere'>) RunningServer[source]#
Start SSH server.
- Parameters:
config – server configuration options
namespace – dictionary in which Python code commands will be executed
server_factory – optional protocol handler class
- class herethere.here.ServerConfig(host: str, port: int, username: str, password: str, key_path: str, chroot: str)[source]#
Bases:
ConnectionConfigSSH server configuration.
- property asdict: dict[str, Any]#
Dict represntation of the instance.
- classmethod load(prefix: str = '', path: str = None) ConnectionConfig#
Load configuration from the environment, and file with configurations variables. If path is not specified, variables are loaded from a file named {prefix}.env in the current directory or any of its parents.
- Parameters:
prefix – prefix for variables ({PREFIX}_HOST), and a configuration file name to search for: {prefix}.env
path – explicit configuration file location
- classmethod load_from_dict(*, env: dict[str, str], prefix: str) ConnectionConfig#
Load config from dictionary.
- save(path: str, prefix: str = '')#
Save config to the given location.
There: client classes#
- class herethere.there.Client[source]#
Client for remote interpreter.
- async connect(config: ConnectionConfig)[source]#
Connect to remote.
- async runcode(code: str, stdout: TextIO | None = None, stderr: TextIO | None = None) str[source]#
Execute python code on the remote side.
- async runcode_background(code: str, stdout: TextIO | None = None, stderr: TextIO | None = None) str[source]#
Execute python code in a separate thread on the remote side.
- class herethere.everywhere.config.ConnectionConfig(host: str, port: int, username: str, password: str)[source]#
Remote connection configuration.
- property asdict: dict[str, Any]#
Dict represntation of the instance.
- classmethod load(prefix: str = '', path: str = None) ConnectionConfig[source]#
Load configuration from the environment, and file with configurations variables. If path is not specified, variables are loaded from a file named {prefix}.env in the current directory or any of its parents.
- Parameters:
prefix – prefix for variables ({PREFIX}_HOST), and a configuration file name to search for: {prefix}.env
path – explicit configuration file location
- classmethod load_from_dict(*, env: dict[str, str], prefix: str) ConnectionConfig[source]#
Load config from dictionary.
- herethere.there.commands.there_code_shortcut(handler: Callable[[str], str]) Callable[[Context], None][source]#
Decorator to register %there subcommand to execute Python code.
- Parameters:
handler – a function, that receives text from the Jupyter cell, and returns Python code to execute on the remote side