Skip to main content

An SDK to use the Sinusoidal framework

Project description

Sinusoidal Python SDK

This SDK mirrors the structure of the Rust SDK (sdks/rust/sinusoidal).

Apps are built by subclassing App and running through Sinusoidal:

from dataclasses import dataclass
from sinusoidal.sinusoidal import App, Connection, InputStream, OutStream, Sinusoidal
from sinusoidal.streaming_api_pb2 import Datagram


@dataclass
class MySettings:
    input_stream: InputStream


class MyApp(App):
    def __init__(self, settings: MySettings) -> None:
        self.settings = settings
        self.out: OutStream | None = None

    def handle_connect(self, connection: Connection) -> None:
        connection.connect_to_stream(self.settings.input_stream)
        self.out = connection.register_out_stream("output")

    def handle_packet(
        self, connection: Connection, stream_id: str, d: Datagram
    ) -> None:
        assert self.out is not None
        self.out.send(d)


def main() -> None:
    Sinusoidal(MyApp).run()

Structure

Module Purpose
sinusoidal.sinusoidal Core SDK: App, Connection, OutStream, Sinusoidal, InputStream, OutputStream
sinusoidal.goose GOOSE packet types: GooseEvent, GooseBool, etc.

Building

make setup   # install dev dependencies
make proto   # generate protobuf code
make test    # run tests
make release # typecheck + test + build wheel

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinusoidal-1.0.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinusoidal-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file sinusoidal-1.0.0.tar.gz.

File metadata

  • Download URL: sinusoidal-1.0.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sinusoidal-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aee7107afd519ba04e3b76e8d340fbe511320a8cd4dbd539a73974e95bae8b7e
MD5 f50b63dd879f41e70152a5b2ec86f0aa
BLAKE2b-256 bc75b6116ffaa8f382082245a0a716471b8cc2ba72df767b28cbec8b6506a0d0

See more details on using hashes here.

File details

Details for the file sinusoidal-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sinusoidal-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sinusoidal-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bd221e5cb64915cdfcc6b623d3d1a450bb3d481e759a91be8cfa60f98fe46a0
MD5 dd73b1a3aa5565dfe915aacb0b1dbbce
BLAKE2b-256 ad196c8e9bea15750e926ae8bd7a8ad43310dab1877d641de5e7b311b49bfe1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page