Skip to main content

pyserve

Unify SocketServer Implementations based on a Session Model

Install

pip install pyserve3

Example

from pyserve import *
from typing import Optional

class EchoServer(Session):
    
    def connection_made(self, addr: Address, writer: Writer):
        print('connection made!', addr, writer)
        self.addr   = addr
        self.writer = writer

    def data_recieved(self, data: bytes):
        print(f'recieved {data!r} from {self.addr}')
        self.writer.write(data)
        self.writer.close()

    def connection_lost(self, err: Optional[Exception]):
        print('connection lost!', self.addr, err)

# run sync
# listen_udp_threaded(('127.0.0.1', 8000), EchoServer)
# listen_tcp_threaded(('127.0.0.1', 8000), EchoServer)

# run async
import asyncio
# asyncio.run(listen_udp_async(('127.0.0.1', 8000), EchoServer))
asyncio.run(listen_tcp_async(('127.0.0.1', 8000), EchoServer))

Metadata

Release files for pyserve3 0.0.7

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

Source distribution (sdist)

Source distribution for pyserve3 0.0.7
File Size Uploaded Provenance Actions
pyserve3-0.0.7.tar.gz 7.0 kB Without provenance Details for pyserve3-0.0.7.tar.gz

Release files / pyserve3-0.0.7.tar.gz

Download URL pyserve3-0.0.7.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d13b08331b29824c65a72c58e4aa79cd78fc7f152e0784f18c6b4353820e6294
BLAKE2b-256 checksum
How to use checksums
4c2d259b59337162dacb846a42e32c6dd4bec319c5133ee9e04368c937f21ca2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.3

Security for pyserve3 0.0.7

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