Skip to main content

pondsocket-common

Shared wire types, schemas, and reactive primitives consumed by both pondsocket (server) and (eventually) pondsocket-client (Python client). Mirrors the role of @eleven-am/pondsocket-common in the JavaScript monorepo.

This package has one runtime dependency: pydantic v2.

Install

pip install pondsocket-common

In a workspace it's installed automatically via uv sync.

What's in it

Module Purpose
pondsocket_common.enums ServerActions, ClientActions, ChannelState, PresenceEventTypes, ErrorTypes, ChannelReceiver, SystemSender, Events, PubSubEvents — all StrEnum with exact wire strings
pondsocket_common.schemas Pydantic v2 models: ClientMessage, ServerMessage, PresenceMessage, ChannelEvent, plus parse_client_message / parse_server_message / parse_presence_message / parse_channel_event with comnon-style ValidationError
pondsocket_common.types UserData, IncomingConnection, PresencePayload, PubSubEvent variants, type aliases (PondMessage, PondPresence, PondAssigns, JoinParams)
pondsocket_common.headers Headers — case-insensitive view over ASGI-shape list[tuple[bytes, bytes]]
pondsocket_common.subjects Subject[T] and BehaviorSubject[T] — synchronous reactive primitives mirroring the JS comnon impl
pondsocket_common.errors PondError, status constants (400/401/403/404/409/429/500/503/504), constructor helpers (bad_request, unauthorized, …), MultiError
pondsocket_common.ids uuid() — dashed v4 string

Wire format

Outbound client → server (ClientMessage):

{
  "action": "BROADCAST",
  "event": "message",
  "channelName": "/chat/42",
  "requestId": "<uuid>",
  "payload": {"text": "hi"}
}

Server → client (ServerMessage | PresenceMessage) discriminated on action:

{ "action": "SYSTEM",  "event": "ACKNOWLEDGE", "channelName": "/chat/42", "requestId": "...", "payload": {} }
{ "action": "PRESENCE", "event": "JOIN",       "channelName": "/chat/42", "requestId": "...", "payload": {"presence": [...], "changed": {...}} }

Field names on the wire are camelCase. The Python models use snake_case attributes (request_id, channel_name) with pydantic aliases. Use model_dump(by_alias=True) to serialize to wire form.

Parity with @eleven-am/pondsocket-common

  • Enums have identical string values.
  • Subject/BehaviorSubject mirror the JS classes 1:1 (synchronous fan-out, size property, close() semantics, BehaviorSubject initial-value replay on subscribe).
  • ValidationError(message, path?) formats as "path: message" to match.
  • uuid() returns a dashed lowercase hex string (matches crypto.randomUUID()).

The pydantic models are the canonical schema definitions on the Python side; the JS package uses hand-rolled validators with the same field-name shape.

License

GPL-3.0-or-later.

Metadata

Release files for pondsocket-common 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pondsocket-common 0.0.6
File Size Uploaded Provenance Actions
pondsocket_common-0.0.6.tar.gz 12.1 kB Without provenance Details for pondsocket_common-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pondsocket-common 0.0.6
File Interpreter ABI Platform Actions
pondsocket_common-0.0.6-py3-none-any.whl Python 3 none any Details for pondsocket_common-0.0.6-py3-none-any.whl

Total release size: 22.6 kB

Release files / pondsocket_common-0.0.6.tar.gz

Download URL pondsocket_common-0.0.6.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b257b8d109787baf076029c979df4e47d9c97db55270ecf2e0757e8fc4840459
BLAKE2b-256 checksum
How to use checksums
3e20bd616f5a2818cbb364cb023eb6bbd97f89ebf2d390645d74ad536e7966a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / pondsocket_common-0.0.6-py3-none-any.whl

Download URL pondsocket_common-0.0.6-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
559a868042017faf23959298041fb22291f19b5c4456090b09b309fc26c151a4
BLAKE2b-256 checksum
How to use checksums
c6e4a460a3a827cd90e63ef99c0ac0ae9437a3895b69da1b71223edb5c7a2d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Security for pondsocket-common 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page