Skip to main content

What’s Pyx?

Pyx is yet another async web server written in Python, with the asyncio module.

It’s small and simple. It has no dependency at all except Python itself.

Yet Pyx is also carefully crafted to behave nicely in stressful and dangerous enviroments.

How to install?

Just use pip or tools alike:

pip install pyxserver

What can Pyx do?

Pyx is a simple static file server by itself:

pyx -b localhost -p 8000 -r /some/where

This will start pyx and bind it to localhost:8000, serving files in the directory /some/where

And you can also use the small framework provided by Pyx to write your own dynamic web application:

import asyncio
from pyx import (HttpHeader, HttpConnectionCB)

@asyncio.coroutine
def req_cb(req):
    resp = req.respond(200)
    resp.headers.append(HttpHeader('Content-Length', 5))
    resp.headers.append(HttpHeader('Content-Type', 'text/plain'))
    yield from resp.send()
    yield from resp.send_body(b'hello')

loop = asyncio.get_event_loop()

conn_cb = HttpConnectionCB(req_cb)
starter = asyncio.start_server(conn_cb, '127.0.0.1', 8080, loop=loop)
_server = loop.run_until_complete(starter)

loop.run_forever()

Please see the implementation of pyx.http.StaticRootResource for a more sophisticated example.

License

Pyx is licensed under the terms of the MIT license.

Metadata

Release files for pyxserver 0.1.4

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

Source distribution (sdist)

Source distribution for pyxserver 0.1.4
File Size Uploaded Provenance Actions
pyxserver-0.1.4.tar.gz 15.9 kB Without provenance Details for pyxserver-0.1.4.tar.gz

Release files / pyxserver-0.1.4.tar.gz

Download URL pyxserver-0.1.4.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ce99a1b0ff8bd8b33e103b88c51aaf2585186104d71a219756849af34f308d8d
BLAKE2b-256 checksum
How to use checksums
28be3f742fff12c794128bb12424585fd9f1ecafa823ac1ecc8c1d68f21f794f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyxserver 0.1.4

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