Skip to main content

pynect

pynect is Pynect's Python package. It exports Chanx AsyncAPI schemas, adds an iterator-aware server consumer, and runs Python-owned Chanx applications inside Pynect's one-owner stdio worker.

Install

uv add pynect

Configure the ASGI application in the owning Python project:

[tool.pynect]
app = "server:app"

Server iterators

Subclass Pynect's consumer, use Chanx's standard ws_handler, and annotate an iterator return type. Pynect forwards each item and emits Chanx's protocol-level complete frame when the iterator exits normally.

from collections.abc import AsyncIterator
from chanx.core.decorators import ws_handler
from pynect import AsyncJsonWebsocketConsumer

class CatalogConsumer(AsyncJsonWebsocketConsumer):
    @ws_handler
    async def watch(self, message: WatchRequest) -> AsyncIterator[WatchResponse]:
        yield WatchResponse(payload=message.payload)

pynect.ws_handler remains available for compatibility but is deprecated.

The Pynect consumer also accepts synchronous handlers and synchronous Iterator[Response] streams. Async handlers continue to use Chanx unchanged. Chanx's annotations currently type handlers as async-only, so place a portable ignore on synchronous decorator applications:

# Chanx types handlers as async; Pynect adapts synchronous callables.
@ws_handler  # type: ignore
def watch_sync(self, message: WatchRequest) -> Iterator[WatchResponse]:
    yield WatchResponse(payload=message.payload)

Pynect closes server iterators deterministically after normal completion, early return, iteration failure, send failure, or handler cancellation. Normal completion emits complete; failures remain Chanx handler errors.

Owned stdio transport

The JavaScript startWorker() launcher owns the Python process and sends byte-length-delimited events over stdin. Python multiplexes response events with ordinary stdout and forwards stderr separately. The random per-process marker lets Pynect preserve binary application output without requiring it to end with a newline. There is no socket endpoint, shared mode, endpoint discovery, stale-endpoint cleanup, or parent-PID polling.

MIT licensed.

Metadata

Release files for pynect 0.8.14

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

Source distribution (sdist)

Source distribution for pynect 0.8.14
File Size Uploaded Provenance Actions
pynect-0.8.14.tar.gz 10.5 kB Without provenance Details for pynect-0.8.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pynect 0.8.14
File Interpreter ABI Platform Actions
pynect-0.8.14-py3-none-any.whl Python 3 none any Details for pynect-0.8.14-py3-none-any.whl

Total release size: 23.8 kB

Release files / pynect-0.8.14.tar.gz

Download URL pynect-0.8.14.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
12bbe298ce390d3493f44f192582494a3f1b3152f81926a78e76bbe9a6d47c34
BLAKE2b-256 checksum
How to use checksums
d804e5ed0b67747dbc64ddc8bbe02cf26611db0d9baa899849e3eee4c23994be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pynect-0.8.14-py3-none-any.whl

Download URL pynect-0.8.14-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
728292ee8defd9b048cf866dc1cbf7d730670cde369c23d801393ab6d30107f9
BLAKE2b-256 checksum
How to use checksums
076d8f5bd50b2a78fc4425a829ff3c38885fa6a77473e56a296a127309c25c2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pynect 0.8.14

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