Skip to main content

Write efficient network daemons (HTTP, SSH...) with ease.

Project description

API Hour

API-Hour is a lightweight daemon framework, that lets you write powerful applications.

It was created to answer the need for a simple, robust, and super-fast server-side environment to build very efficient Daemons with ease.

By default, API-Hour Starter Kit (Cookiecutter) creates for you a HTTP daemon to develop WebServices.

With API-Hour, you can quickly convert any AsyncIO server library to multi-processing daemon, ready for production.

https://raw.githubusercontent.com/Eyepea/API-Hour/master/docs/API-Hour_small.png

Quick’n’dirty HTTP benchmarks on a kitchen table

https://raw.githubusercontent.com/Eyepea/API-Hour/master/propaganda/en/stats.png

Scale: Number of queries during 30 seconds with 400 simultaneous connexions.

Benchmark made on a Dell Precision M6800 between API-Hour and Gunicorn with 16 workers.

For details, read information in benchmarks.

Where is the magic to have theses performances ?

Architecture matters a lot more that tools.

We use asynchronous and multiprocess patterns, combined together, to handle as much as possible HTTP requests.

Ideally, the limitation should be your network card, not your CPU nor memory.

Moreover, we’ve tried to reduce as much as possible layers between your code and async sockets.

For each layer, we use the best in term of performance and simplicity:

  1. AsyncIO: an easy asynchronous framework, directly integrated in Python 3.4+

  2. aiohttp.web: HTTP protocol implementation for AsyncIO + Web framework

  3. ujson: fastest JSON serialization

Examples

  1. API-Hour Starter Kit (Cookiecutter)

  2. API-Hour implementation of TechEmpower Web Framework Benchmarks

  3. HTTP+SSH Daemon

  4. Quick’n’dirty benchmarks on a kitchen table

How-to start an API-Hour project ?

You can follow one of our tutorials

Support

Requirements

  • Python 3.5+

Install

Follow official documentation.

License

API-Hour is offered under the Apache 2 license.

Architecture

API-Hour is a glue between your code and Gunicorn to launch your code in several process.

Origin

API-Hour was a fork of aiorest, now only based on Gunicorn for multiprocessing.

Thanks

Thanks to Gunicorn, aiorest, aiohttp and AsyncIO community, they made 99,9999% of the job for API-Hour.

Special thanks to Andrew Svetlov, the creator of aiorest.

Goals of API-Hour

  1. Fast: API-Hour is designed from bottom-up to be extremely fast, and capable of handling a huge load. It uses Python 3 and its new powerful AsyncIO package.

  2. Scalable: API-Hour is built to be elastic, and easily scalable.

  3. Lightweight:
    1. small codebase: Doing less means being faster: the codebase for processing an request is kept as small as possible. Beyond this base foot-print, you can of course activate, preload and initialize more plugins or packages , but that choice is yours.

    2. flexible setup: Some people have no problems with using many dependencies, while others want to have none (other than Python). Some people are ok to loose a bit on performance, for the ease (and speed) of coding, while others wouldn’t sacrifice a millisecond for ready-made functionality. These choices are yours, so there are no mandatory extra layer, plugin or middleware.

  4. Easy: API-Hour is meant to be very easy to grasp: No steep learning curve, no mountain of docs to read: Download our turn-key “Hello-world” applications, and immediately start coding your own application from there.

  5. Packages-friendly and friendly-packages: We try to let you use external packages without the need to re-write them, adapt them, “ wrap “ them or embed them in the framework. On the other hand, API-Hour “ plugins “ are written as much as possible to be usable as stand-alone packages outside the framework, to benefit to more people.

  6. Asynchronous… or not: If you don’t need the extra complexity of building asynchronous code, you don’t have to (you’ll still enjoy tremendous performance). You can just handle your requests in a traditional synchronous way. On the other hand, if your project does IO or processing that could benefit from parallelizing tasks, the whole power of Async. IO, futures, coroutines and tasks is at your fingertips. All provided plugins (in particular, Database plugins) are Async-ready.

CHANGES

0.8.2 (2017-11-10)

  • Add pre_start coroutine

  • Fix setup.py to check correctly minimal Python version. Thanks @romuald

0.8.1 (2016-07-08)

  • Drop support of Python 3.3 and 3.4

0.7.1 (2016-07-08)

0.7.0 (2015-05-04)

  • Add HTML serializer plugin

  • Add AsyncIO high level stream server support (Used by FastAGI implementation of Panoramisk)

  • Now, you can use make_handler method to connect directly your handlers with your sockets for more flexibility

0.6.2 (2015-02-24)

  • You can customize event loop used with make_event_loop() class method in Container

0.6.1 (2015-02-10)

  • Release a new version because PyPI is bugged: 0.6.0 is broken on PyPI

0.6.0 (2015-01-13)

  • API-Hour config file is now optional, use -ac to auto-configure your app

  • Add Python 3.3 compatibility to use easily Python 3 directly from distributions package

  • Add Debian/Ubuntu package

  • ujson is now optional for aiohttp.web

  • More documentation with tutorials: all-in-one and Starter Kit

  • If api_hour CLI has no logging file, enable logging on console by default

0.5.0 (2015-01-07)

  • Project reboot

  • Change API-Hour main goal: API-Hour can now multiprocess all AsyncIO lib server, not only HTTP

  • API-Hour is now based on Gunicorn

  • Remove aiorest fork, recommend to use aiohttp.web for HTTP daemons in cookiecutter

0.3.3 (2014-12-19)

  • Static files can be served automatically

  • body and json_body and transport accessible in Request

  • loop accessible in Application

  • Asset Serializer accepts encoding

  • cookiecutter available at https://github.com/Eyepea/cookiecutter-API-Hour

  • Use of ujson

  • Bugfixes

0.3.2 (2014-10-31)

  • Refactoring and clean-up

  • Publish benchmark server for API-Hour

  • English version of PyCON-FR presentation about API-Hour

  • Fix response.write_eof() to follow aiohttp changes (Thanks aiorest for the patch)

0.3.1 (2014-10-28)

  • Rename multi_process to arbiter

  • Improve Python packaging

0.3.0 (2014-10-26)

  • First version of API-Hour, performance oriented version of aiorest

  • cookiecutter template

  • Serialization support

  • replace json by ujson

  • basic multiprocessing

0.2.4 (2014-09-12)

  • Make loop keywork-only parameter in create_session_factory() function

0.2.3 (2014-08-28)

  • Redis session switched from asyncio_redis to aioredis

0.2.2 (2014-08-15)

0.1.1 (2014-07-09)

  • Switched to aiohttp v0.9.0

0.1.0 (2014-07-07)

  • Basic REST API

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

api_hour-0.8.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

api_hour-0.8.2-py2.py3-none-any.whl (18.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file api_hour-0.8.2.tar.gz.

File metadata

  • Download URL: api_hour-0.8.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for api_hour-0.8.2.tar.gz
Algorithm Hash digest
SHA256 78d4cdbe1e5f9b3052e54684750b95ba98abe61744528d4232b90fc5ae0a5e6f
MD5 dc090290b647402f4f85ba07d0817732
BLAKE2b-256 b6cfedf9320017663a43f618d27ee040e8728f351c3c4a03b9303ecd3f9475de

See more details on using hashes here.

File details

Details for the file api_hour-0.8.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for api_hour-0.8.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 848b808f6a91a99f5d5c9420c1cc36a7db579e433ffa7f3fa6361e751c23e897
MD5 1a28f83aeb51752c19e919ecc7800205
BLAKE2b-256 d17de24af61dedefe67b71631d89b9d0c068aec2d54585026ab1fed58bbb6bfb

See more details on using hashes here.

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