Skip to main content

An SDK to use the Sinusoidal framework

Project description

Sinusoidal Python SDK (v2)

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-0.0.4.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-0.0.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sinusoidal-0.0.4.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-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8f829cbaa83f39467865d9f4cfba0b73960fba1dc7c30b47b5ac5df9da2315b9
MD5 7c2d53acbe6d6ef1ea81dc8a1dbd11b8
BLAKE2b-256 eb0297fdfc3f50463153cecd05a3614cf91a5f68dc10ab4dd6f6708c39b222cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sinusoidal-0.0.4-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-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dd9f7fbc5ab20d5e9efbc845e65b464ce5bb4b83ad14fb868f2eefcb31fd83c3
MD5 cb6537efa003a12c339b430e476f55a5
BLAKE2b-256 a7dca72b7fbc432b89ebe3033d6c18d97c275264ac4ff49c41f37c4dc8008711

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