Skip to main content

Zero-dependency router for building HTTP services.

Project description

muxy

muxy is a lightweight router for building HTTP services conforming to Granian's Rust Server Gateway Interface (RSGI). It intentionally avoids magic, prioritising explicit and composable code.

uv add muxy

Features

  • first-class router composition - modularise your code by nesting routers with no overhead
  • correct, efficient routing - explicit route heirarchy so behaviour is always predictable
  • lightweight - the core router is little more than a simple datastructure
  • control - control the full HTTP request/response cycle without digging through framework layers
  • middleware - apply common logic to path groups simply and clearly

Inspiration

Go's net/http and go-chi/chi are inspirations for muxy. I wanted their simplicity without having to switch language. You can think of the RSGI interface as the muxy equivalent of the net/http HandlerFunc interface, and muxy.Router as an equivalent of chi's Mux.

Examples

Getting started

import asyncio

from granian.server.embed import Server
from muxy.router import Router


async def main() -> None:
    router = Router()
    router.get("/", lambda _, p: p.response_str(200, [], "Hello world!"))

    server = Server(router)
    await server.serve()


if __name__ == "__main__":
    asyncio.run(main())

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

muxy-0.1.0.dev4.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muxy-0.1.0.dev4-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file muxy-0.1.0.dev4.tar.gz.

File metadata

  • Download URL: muxy-0.1.0.dev4.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for muxy-0.1.0.dev4.tar.gz
Algorithm Hash digest
SHA256 fbdc9ce22c6ff4bc13a0462b97419fa55a980140a452923f85ba6444e10e4782
MD5 8088c6d7225880ade032e99f69c947af
BLAKE2b-256 64b53b9e9604bfde1f6c789c46a35d9fab2d74da910f5f3f67807176daea3370

See more details on using hashes here.

Provenance

The following attestation bundles were made for muxy-0.1.0.dev4.tar.gz:

Publisher: release.yaml on oliverlambson/muxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file muxy-0.1.0.dev4-py3-none-any.whl.

File metadata

  • Download URL: muxy-0.1.0.dev4-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for muxy-0.1.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 3aadbd0e8cec3a84dd21e052fd66ba7d74dd4728c24386a2b7d4268439b53e37
MD5 7a384a16d4cdf33f317a5266d2173a1a
BLAKE2b-256 b73504375c272c229c1ef40b75654793357192fdbf7e09aa715176b67eb8f8a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for muxy-0.1.0.dev4-py3-none-any.whl:

Publisher: release.yaml on oliverlambson/muxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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