Code Monkey home page Code Monkey logo

extra's Introduction

                  __                   ._.
  ____  ___  ____/  |_ _______ _____   | |
_/ __ \ \  \/  /\   __\\_  __ \\__  \  | |
\  ___/  >    <  |  |   |  | \/ / __ \_ \|
 \___  >/__/\_ \ |__|   |__|   (____  / __
     \/       \/                    \/  \/

Extra is an asynchronous HTTP/1, HTTP/2 and WebSocket toolkit written in Python and compatible with ASGI and WSGI.

It is focused on providing primitives for creating web services, implemented to work well both in development and production while providing a great developer experience.

Features:

  • Streaming reads and writes, lazy decoding and encoding
  • Embedded asynchronous HTTP/1 development server
  • Implementation compiled using mypyc for performance

Planned:

  • Mount services on FUSE and query from the CLI
  • Multiple backends: ASGI, WSGI, AsyncIO, AIOHTTP, AWS Lambda, socket, file
  • Building blocks for channels, pub/sub, topic tree.
  • Multi-threaded async (leverage all cores)
  • Dynamically (re)loadable services

Design principles

  • Declarative: decorators to expose methods as web services
  • Stream-oriented: encourages writing stream processing handlers
  • Service focused: template are left out, but lots of building blocks are available for services.

Extra is the successor of Retro, one of the oldest decorator-based framework for HTTP applications and built on the 15+ years of experience developing and maintainig that toolkit.

Like Retro, Extra is designed as a kit, providing easily composable building blocks that help you build fast, readable and resilient web services.

Similar projects include Quart, Starlette. and bareASGI.

Example: Hello, World! Service

Here is helloworld.py:

from extra import Service, Request, Response, on, server

class HelloWorld(Service):
    @on(GET="{any}")
    def helloWorld(self, request: Request) -> Response:
        return request.respond(b"Hello, World !"), b"text/plain")

app = server(HelloWorld)

And this above can be started with uvicorn helloworld:app.

extra's People

Contributors

sebastien avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

nzx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.