Skip to main content

A toolkit to write HTTP/1.1 web services and applications, with first class support for streaming

Project description

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

Extra is an toolkit to write HTTP/1.1 web services and applications, with first class support for streaming.

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.

Key Features:

  • Client and server
  • Streaming reads and writes, lazy decoding and encoding
  • Embedded asynchronous HTTP/1 development server
  • Only requires Python stdlib
  • Good baseline performance (5-10K RPS on average hardware)

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.

Highlights:

  • Pre/post conditions for request handlers
  • HTML templating (plays nice with HTMX)
  • CORS support
  • Configurable proxy support
  • Integrated logging
  • Regexp-based tree router

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 maintaining 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, bareASGI and of course, FastAPI.

Example: Hello, World! Service

Here is helloworld.py:

#!/usr/bin/env uv run --with extra-http
from extra import Service, HTTPRequest, HTTPResponse, on, run

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

app = run(HelloWorld())

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

extra_http-1.0.11.tar.gz (58.9 kB view details)

Uploaded Source

Built Distribution

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

extra_http-1.0.11-py3-none-any.whl (67.8 kB view details)

Uploaded Python 3

File details

Details for the file extra_http-1.0.11.tar.gz.

File metadata

  • Download URL: extra_http-1.0.11.tar.gz
  • Upload date:
  • Size: 58.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for extra_http-1.0.11.tar.gz
Algorithm Hash digest
SHA256 f9d7600ca94ef237d9d54acdf253982deed82872d1cd3562f4c77404a7ddc0b9
MD5 de57ed86799e6bed4385b55b67c2280c
BLAKE2b-256 b350195685db6d319e16fce952a9291c5a3c212f87a6f8062fcecb9c6d7edcfd

See more details on using hashes here.

File details

Details for the file extra_http-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: extra_http-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 67.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for extra_http-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 16182d51014597329bc5c9e5e97ff2a2556dae7f6a8c9e712304832912942b54
MD5 b781cc4927ded5bbbbc533d1d45c2bd9
BLAKE2b-256 86dfdefb79f26d7a405b115b97c868a353b2a3cd57e1a38612293b654671d3a1

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