Skip to main content

Allin is an experimental asynchronous web framework.

Project description

allin

Allin is an experimental asynchronous web framework.

PyPI - Downloads PyPI PyPI - Status

I didn't expect this framework to be used in a production environment, as it's still in the early stages of development. Not sure when this framework can be used in production 😬

You can help this project get better by creating an issue or PR. Thank you for your time!

Table of Contents:

Allin is heavily inspired by Flask, Starlette & Falcon.

:raised_eyebrow: Why ?

I'm just curious :monocle_face:

Yup, I'm curious about how a web application based on ASGI works.

It may not yet fully comply with the ASGI application specifications as documented. But, for the main features like route mapping, HTTP responses, error handling, parsing the request body it's there.

...and I want to build my own framework from scratch so I know how the application works.

Literally, the "framework parts" weren't built from scratch as I also used third party modules and some "parts from other sources" were used as references.

This is part of the journey

:books: Roadmap

  • Lifespan Protocol

  • HTTP Protocol

    • HTTP Headers

    • HTTP Request

      • JSON Body Support
      • MessagePack Body Support
      • Form Data Support
      • Cookies
      • Query Parameters
    • HTTP Responses

      • JSONResponse
      • MessagePackResponse
    • HTTP Middleware

      • Before HTTP Request
      • After HTTP Request
    • Routing

      • Decorator shortcuts such as @get, @post, @put, etc. are available.
      • Nesting routers
  • Extension

  • Websocket Support

:star_struck: Features

  • Global variables. (It means, you can access the app and request object instances globally)
  • Error handling
  • JSON and MessagePack requests are supported out of the box (thanks to msgspec)
  • Form Data Support (application/x-www-form-urlencoded or multipart/form-data)
  • Decorator shortcuts such as @get, @post, @put, etc. are available.
  • Nesting routers

:love_you_gesture: Quick Start

Here is an example application based on the Allin framework and I'm sure you are familiar with it.

from allin import Allin, JSONResponse

app = Allin()

@app.route("/")
async def index():
    return JSONResponse({"message": "Hello World!"})
:point_down: Explanation
  • The app variable is the ASGI application instance.
  • And we create an endpoint with the route / on the line app.route(...)
  • Then we add the index() function to handle the / route.
  • And the handler function will return a JSON response with the content {"message": "Hello World!"}

That's it! looks familiar right?

Want more? check out other sample projects here

:sunglasses: Installation

Install from source

git clone --depth 1 https://github.com/aprilahijriyan/allin.git
cd allin

Need https://python-poetry.org/ installed on your device

poetry build
pip install ./dist/*.whl

Install with pip

Currently I just published the pre-release version v0.1.1a0. So, maybe you need to install it with the --pre option. Example:

pip install --pre allin

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

allin-0.1.1a1.tar.gz (20.6 kB view hashes)

Uploaded Source

Built Distribution

allin-0.1.1a1-py3-none-any.whl (23.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page