runtimepy.net package#
Subpackages#
- runtimepy.net.apps package
- Module contents
AppInfoAppInfo.all_finalized()AppInfo.configAppInfo.config_param()AppInfo.conn_managerAppInfo.connectionsAppInfo.exceptions()AppInfo.loggerAppInfo.namesAppInfo.original_config()AppInfo.peersAppInfo.raised_exceptionAppInfo.result()AppInfo.resultsAppInfo.search()AppInfo.search_tasks()AppInfo.single()AppInfo.stackAppInfo.stopAppInfo.structsAppInfo.task_managerAppInfo.tasksAppInfo.tuiAppInfo.with_new_logger()
exception()fail()init_only()noop()wait_for_stop()
- Module contents
- runtimepy.net.arbiter package
- Subpackages
- Submodules
- runtimepy.net.arbiter.base module
- runtimepy.net.arbiter.info module
AppInfoAppInfo.all_finalized()AppInfo.configAppInfo.config_param()AppInfo.conn_managerAppInfo.connectionsAppInfo.exceptions()AppInfo.loggerAppInfo.namesAppInfo.original_config()AppInfo.peersAppInfo.raised_exceptionAppInfo.result()AppInfo.resultsAppInfo.search()AppInfo.search_tasks()AppInfo.single()AppInfo.stackAppInfo.stopAppInfo.structsAppInfo.task_managerAppInfo.tasksAppInfo.tuiAppInfo.with_new_logger()
RuntimeStructSampleStructTrigStruct
- runtimepy.net.arbiter.result module
- runtimepy.net.arbiter.task module
- runtimepy.net.arbiter.udp module
- runtimepy.net.arbiter.websocket module
- Module contents
AppInfoAppInfo.all_finalized()AppInfo.configAppInfo.config_param()AppInfo.conn_managerAppInfo.connectionsAppInfo.exceptions()AppInfo.loggerAppInfo.namesAppInfo.original_config()AppInfo.peersAppInfo.raised_exceptionAppInfo.result()AppInfo.resultsAppInfo.search()AppInfo.search_tasks()AppInfo.single()AppInfo.stackAppInfo.stopAppInfo.structsAppInfo.task_managerAppInfo.tasksAppInfo.tuiAppInfo.with_new_logger()
ArbiterTaskArbiterTaskManagerConnectionArbiterTaskFactoryinit_only()
- runtimepy.net.factories package
- Module contents
HttpConnectionRuntimepyWebsocketConnectionRuntimepyWebsocketConnection.disable_extra()RuntimepyWebsocketConnection.first_clientRuntimepyWebsocketConnection.first_messageRuntimepyWebsocketConnection.init()RuntimepyWebsocketConnection.send_interfacesRuntimepyWebsocketConnection.tab_sender()RuntimepyWebsocketConnection.tabsRuntimepyWebsocketConnection.ui_time
RuntimepyWebsocketJsonTcpConnectionTcpConnection.app()TcpConnection.close()TcpConnection.create_connection()TcpConnection.create_pair()TcpConnection.log_aliasTcpConnection.log_prefixTcpConnection.restart()TcpConnection.send_binary()TcpConnection.send_text()TcpConnection.serve()TcpConnection.uses_binary_tx_queueTcpConnection.uses_text_tx_queue
TcpConnectionFactoryTcpEchoTcpMessageTcpMessageEchoTcpNullUdpConnectionUdpConnection.close()UdpConnection.create_connection()UdpConnection.create_pair()UdpConnection.latest_rx_addressUdpConnection.process_datagram()UdpConnection.restart()UdpConnection.send_binary()UdpConnection.send_text()UdpConnection.sendto()UdpConnection.set_remote_address()UdpConnection.uses_binary_tx_queueUdpConnection.uses_text_tx_queue
UdpConnectionFactoryUdpEchoUdpMessageUdpMessageEchoUdpNullWebsocketConnectionWebsocketConnectionFactoryWebsocketEchoWebsocketNull
- Module contents
- runtimepy.net.http package
- runtimepy.net.server package
- Subpackages
- runtimepy.net.server.app package
- Subpackages
- Submodules
- runtimepy.net.server.app.base module
- runtimepy.net.server.app.create module
- runtimepy.net.server.app.elements module
- runtimepy.net.server.app.files module
- runtimepy.net.server.app.placeholder module
- runtimepy.net.server.app.pyodide module
- runtimepy.net.server.app.sound module
- runtimepy.net.server.app.tab module
- Module contents
- runtimepy.net.server.struct package
- runtimepy.net.server.websocket package
- runtimepy.net.server.app package
- Submodules
- runtimepy.net.server.html module
- runtimepy.net.server.json module
- Module contents
RuntimepyServerConnectionRuntimepyServerConnection.add_path()RuntimepyServerConnection.appsRuntimepyServerConnection.class_pathsRuntimepyServerConnection.default_appRuntimepyServerConnection.favicon_dataRuntimepyServerConnection.get_handler()RuntimepyServerConnection.init()RuntimepyServerConnection.json_dataRuntimepyServerConnection.log_paths()RuntimepyServerConnection.pathsRuntimepyServerConnection.try_file()
package_data_dir()
- Subpackages
- runtimepy.net.stream package
- Subpackages
- Submodules
- runtimepy.net.stream.base module
- runtimepy.net.stream.string module
- Module contents
EchoMessageConnectionEchoTcpMessageConnectionEchoUdpMessageConnectionPrefixedMessageConnectionPrefixedMessageConnection.envPrefixedMessageConnection.init()PrefixedMessageConnection.loggerPrefixedMessageConnection.process_binary()PrefixedMessageConnection.process_single()PrefixedMessageConnection.processorPrefixedMessageConnection.send_message()PrefixedMessageConnection.send_message_str()PrefixedMessageConnection.tx_binary_hwmPrefixedMessageConnection.tx_text_hwm
StringMessageConnectionTcpPrefixedMessageConnectionTcpStringMessageConnectionUdpPrefixedMessageConnectionUdpStringMessageConnection
- runtimepy.net.tcp package
- Subpackages
- Submodules
- runtimepy.net.tcp.connection module
EchoTcpConnectionNullTcpConnectionTcpConnectionTcpConnection.app()TcpConnection.close()TcpConnection.create_connection()TcpConnection.create_pair()TcpConnection.envTcpConnection.log_aliasTcpConnection.log_prefixTcpConnection.loggerTcpConnection.remote_addressTcpConnection.restart()TcpConnection.send_binary()TcpConnection.send_text()TcpConnection.serve()TcpConnection.tx_binary_hwmTcpConnection.tx_text_hwmTcpConnection.uses_binary_tx_queueTcpConnection.uses_text_tx_queue
- runtimepy.net.tcp.create module
- runtimepy.net.tcp.protocol module
- Module contents
EchoTcpConnectionNullTcpConnectionTcpConnectionTcpConnection.app()TcpConnection.close()TcpConnection.create_connection()TcpConnection.create_pair()TcpConnection.envTcpConnection.log_aliasTcpConnection.log_prefixTcpConnection.loggerTcpConnection.remote_addressTcpConnection.restart()TcpConnection.send_binary()TcpConnection.send_text()TcpConnection.serve()TcpConnection.tx_binary_hwmTcpConnection.tx_text_hwmTcpConnection.uses_binary_tx_queueTcpConnection.uses_text_tx_queue
- runtimepy.net.udp package
- Submodules
- runtimepy.net.udp.connection module
EchoUdpConnectionNullUdpConnectionUdpConnectionUdpConnection.close()UdpConnection.create_connection()UdpConnection.create_pair()UdpConnection.envUdpConnection.latest_rx_addressUdpConnection.loggerUdpConnection.process_datagram()UdpConnection.remote_addressUdpConnection.restart()UdpConnection.send_binary()UdpConnection.send_text()UdpConnection.sendto()UdpConnection.set_remote_address()UdpConnection.tx_binary_hwmUdpConnection.tx_text_hwmUdpConnection.uses_binary_tx_queueUdpConnection.uses_text_tx_queue
- runtimepy.net.udp.create module
- runtimepy.net.udp.protocol module
- runtimepy.net.udp.queue module
- Module contents
EchoUdpConnectionNullUdpConnectionQueueUdpConnectionUdpConnectionUdpConnection.close()UdpConnection.create_connection()UdpConnection.create_pair()UdpConnection.envUdpConnection.latest_rx_addressUdpConnection.loggerUdpConnection.process_datagram()UdpConnection.remote_addressUdpConnection.restart()UdpConnection.send_binary()UdpConnection.send_text()UdpConnection.sendto()UdpConnection.set_remote_address()UdpConnection.tx_binary_hwmUdpConnection.tx_text_hwmUdpConnection.uses_binary_tx_queueUdpConnection.uses_text_tx_queue
- runtimepy.net.websocket package
Submodules#
runtimepy.net.backoff module#
A module implementing a simple exponential-backoff interface.
- class runtimepy.net.backoff.ExponentialBackoff(interval: float = 0.1, max_sleep: float = 10.0, max_tries: int = 20)[source]#
Bases:
objectA class implementing a simple exponential-backoff handler.
- attempt: int#
- property give_up: bool#
Determine whether or not to give up based on the number of attempts.
- wait: float#
runtimepy.net.connection module#
A module implementing a network-connection interface.
- class runtimepy.net.connection.Connection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
LoggerMixinLevelControl,ChannelEnvironmentMixin,ABCA connection interface.
- property auto_restart: bool#
Determine if this connection should be automatically restarted.
- connected = True#
- default_auto_restart = False#
- property disabled: bool#
Determine if this connection is disabled.
- async process(stop_sig: Event = None, disable_time: float = None, backoff: ExponentialBackoff = None) None[source]#
Process tasks for this connection while the connection is active.
- async restart() bool[source]#
Reset necessary underlying state for this connection to ‘process’ again.
- uses_binary_tx_queue = True#
- uses_text_tx_queue = True#
- class runtimepy.net.connection.EchoConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
ConnectionA connection that just echoes what it was sent.
- class runtimepy.net.connection.NullConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
ConnectionA connection that doesn’t do anything with incoming data.
runtimepy.net.manager module#
A module implementing a connection manager.
- class runtimepy.net.manager.ConnectionManager[source]#
Bases:
LoggerMixinA class for managing connection processing at runtime.
- async manage(stop_sig: Event) None[source]#
Handle incoming connections until the stop signal is set.
- property num_connections: int#
Return the number of managed connections.
runtimepy.net.mixin module#
Various networking-related class utilities.
- class runtimepy.net.mixin.BinaryMessageQueueMixin[source]#
Bases:
objectA mixin for adding a ‘queue’ attribute.
runtimepy.net.util module#
A module implementing various networking utilities.
- class runtimepy.net.util.IPv4Host(name: str = '', port: int = 0)[source]#
Bases:
NamedTupleSee: https://docs.python.org/3/library/socket.html#socket-families.
- name: str#
Alias for field number 0
- port: int#
Alias for field number 1
- class runtimepy.net.util.IPv6Host(name: str = '', port: int = 0, flowinfo: int = 0, scope_id: int = 0)[source]#
Bases:
NamedTupleSee: https://docs.python.org/3/library/socket.html#socket-families.
- flowinfo: int#
Alias for field number 2
- name: str#
Alias for field number 0
- port: int#
Alias for field number 1
- scope_id: int#
Alias for field number 3
- runtimepy.net.util.get_free_socket(local: IPv4Host | IPv6Host = None, kind: int = SocketKind.SOCK_STREAM, reuse: bool = False) socket[source]#
Attempt to get an available socket.
- runtimepy.net.util.get_free_socket_name(local: IPv4Host | IPv6Host = None, kind: int = SocketKind.SOCK_STREAM) IPv4Host | IPv6Host[source]#
Create a socket to determine an arbitrary port number that’s available. There is an inherent race condition using this strategy.
- runtimepy.net.util.hostname(ip_address: str) str[source]#
Attempt to get a string hostname for a string IP address argument that ‘gethostbyaddr’ accepts. Otherwise return the original string
- runtimepy.net.util.hostname_port(ip_address: str, port: int) str[source]#
Get a hostname string with a port appended.
- runtimepy.net.util.normalize_host(*args: str | int | IPv4Host | IPv6Host | None) IPv4Host | IPv6Host[source]#
Get a host object from caller parameters.
Module contents#
A module aggregating commonly used networking interface.
- class runtimepy.net.Connection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
LoggerMixinLevelControl,ChannelEnvironmentMixin,ABCA connection interface.
- property auto_restart: bool#
Determine if this connection should be automatically restarted.
- connected = True#
- default_auto_restart = False#
- property disabled: bool#
Determine if this connection is disabled.
- env: ChannelEnvironment#
- logger: LoggerType#
- async process(stop_sig: Event = None, disable_time: float = None, backoff: ExponentialBackoff = None) None[source]#
Process tasks for this connection while the connection is active.
- async restart() bool[source]#
Reset necessary underlying state for this connection to ‘process’ again.
- tx_binary_hwm: int#
- tx_text_hwm: int#
- uses_binary_tx_queue = True#
- uses_text_tx_queue = True#
- class runtimepy.net.ConnectionManager[source]#
Bases:
LoggerMixinA class for managing connection processing at runtime.
- async manage(stop_sig: Event) None[source]#
Handle incoming connections until the stop signal is set.
- property num_connections: int#
Return the number of managed connections.
- class runtimepy.net.EchoConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
ConnectionA connection that just echoes what it was sent.
- class runtimepy.net.ExponentialBackoff(interval: float = 0.1, max_sleep: float = 10.0, max_tries: int = 20)[source]#
Bases:
objectA class implementing a simple exponential-backoff handler.
- attempt: int#
- property give_up: bool#
Determine whether or not to give up based on the number of attempts.
- wait: float#
- class runtimepy.net.IPv4Host(name: str = '', port: int = 0)[source]#
Bases:
NamedTupleSee: https://docs.python.org/3/library/socket.html#socket-families.
- name: str#
Alias for field number 0
- port: int#
Alias for field number 1
- class runtimepy.net.IPv6Host(name: str = '', port: int = 0, flowinfo: int = 0, scope_id: int = 0)[source]#
Bases:
NamedTupleSee: https://docs.python.org/3/library/socket.html#socket-families.
- flowinfo: int#
Alias for field number 2
- name: str#
Alias for field number 0
- port: int#
Alias for field number 1
- scope_id: int#
Alias for field number 3
- class runtimepy.net.NullConnection(logger: Logger | LoggerAdapter[Any], env: ChannelEnvironment = None, add_metrics: bool = True)[source]#
Bases:
ConnectionA connection that doesn’t do anything with incoming data.
- runtimepy.net.get_free_socket(local: IPv4Host | IPv6Host = None, kind: int = SocketKind.SOCK_STREAM, reuse: bool = False) socket[source]#
Attempt to get an available socket.
- runtimepy.net.get_free_socket_name(local: IPv4Host | IPv6Host = None, kind: int = SocketKind.SOCK_STREAM) IPv4Host | IPv6Host[source]#
Create a socket to determine an arbitrary port number that’s available. There is an inherent race condition using this strategy.
- runtimepy.net.hostname(ip_address: str) str[source]#
Attempt to get a string hostname for a string IP address argument that ‘gethostbyaddr’ accepts. Otherwise return the original string
- runtimepy.net.normalize_host(*args: str | int | IPv4Host | IPv6Host | None) IPv4Host | IPv6Host[source]#
Get a host object from caller parameters.