Skip to main content

A simple ASGI based web framework for exposing HTTP and MCP tools

Project description

Aioserve

A lightweight, modern, and async web framework for Python. Built on ASGI, it provides a simple yet powerful way to build web services and APIs.

License: MIT Python Versions

Features

  • Async to the Core: Built on top of ASGI (Asynchronous Server Gateway Interface).
  • Simple Routing: Expressive decorator-based routing (@app.get, @app.post).
  • Middleware Support: easily extend functionality with middleware.
  • JSON Support: Built-in JSON request parsing and response generation.
  • Lightweight: Minimal dependencies, fast execution.

Installation

pip install aioserve

Quick Start

Create a file named main.py:

from aioserve.server.app import App, app
from aioserve.server.http import JSONResponse

# Define a route
@app.get("/")
async def home(request):
    return JSONResponse({"message": "Hello, Aioserve!"})

# Run with uvicorn
# uvicorn main:app

Usage

Routing

@app.get("/items")
async def get_items(request):
    return ["item1", "item2"]

@app.post("/items")
async def create_item(request):
    data = await request.json()
    return JSONResponse(data, status_code=201)

Middleware

You can add middleware to wrap your application. Middleware allows you to intercept requests and responses.

class LoggingMiddleware:
    def __init__(self, app):
        self.app = app

    async def __call__(self, scope, receive, send):
        print(f"Request: {scope['method']} {scope['path']}")
        await self.app(scope, receive, send)

app.add_middleware(LoggingMiddleware)

Development

To contribute or run tests locally:

  1. Clone the repository.
  2. Install dependencies with Poetry:
    poetry install
    
  3. Run tests:
    poetry run pytest
    

License

This project is licensed under the MIT License.

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

aioserve-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

aioserve-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file aioserve-0.1.0.tar.gz.

File metadata

  • Download URL: aioserve-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for aioserve-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c53c30c6645c6d64e4b5daa8411bbf5603d24bec708ac7b57727319cc8f30dc4
MD5 3768ff377f86653a86fa5f675eb8417c
BLAKE2b-256 93e9f38e62fd34d99eca1c8ca5d36be0d0d4e42781b380e05b5e5175984d425c

See more details on using hashes here.

File details

Details for the file aioserve-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aioserve-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Windows/11

File hashes

Hashes for aioserve-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b86625f62a233460ed4fbba7d770e6c53bc8102cd816d7f5170d84ef67f6de43
MD5 52d5dc8b716935f6acd6c66d5dbad587
BLAKE2b-256 9a46470c9b0afa024f9979481b6de0a230656f5dc6d192026f896bdff25c3f1f

See more details on using hashes here.

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