Asynchronous Server App Boilerplate (or ASAB for short) is a microservice framework for Python 3 and asyncio. The aim of ASAB is to minimize the amount of code that needs to be written when building a microservice or an aplication server. ASAB is fully asynchronous using async/await syntax from Python 3, making your code modern, non-blocking, speedy and hence scalable. We make every effort to build ASAB container-friendly so that you can deploy ASAB-based microservice via Docker or Kubernetes in a breeze.
ASAB is the free and open-source software, available under BSD licence. It means that anyone is freely licenced to use, copy, study, and change the software in any way, and the source code is openly shared so that people could voluntarily improve the design of the software. Anyone can (and is encouraged to) use ASAB in his or her projects, for free.
ASAB is currently used for microservices, web application servers, ETL or stream processors.
ASAB is developed on GitHub. Contributions are welcome!
Installation
$ pip install asab
Documentation
Example
#!/usr/bin/env python3
import asab.web.rest
class MyApplication(asab.Application):
def __init__(self):
super().__init__()
# Create the Web server
web = asab.web.create_web_server(self)
# Add a route to the handler method
web.add_get('/hello', self.hello)
# This is the web request handler
async def hello(self, request):
return asab.web.rest.json_response(request, data="Hello, world!\n")
if __name__ == '__main__':
# Create and start the application
app = MyApplication()
app.run()
The application is available at http://localhost:8080/. You can test it by:
$ curl http://localhost:8080/hello
Microservices
Here is a growing list of Open Source microservices built using ASAB:
ASAB Iris: document rendering, sends output using email, SMS and instant messaging
SeaCat Auth: authentication, authorization, identity management, session management and other access control features
Highlights
Unified approach to Configuration
Logging using reasonably configured Python logging module
Build-in and custom Metrics with feeds into InfluxDB and Prometheus
Alerting with integration to PagerDuty and OpsGenie.
HTTP Server powered by aiohttp library
Apache Zookeeper Client provides shared consensus across microservices’ cluster
Persistent storage abstraction based on upsertor for MongoDB and ElasticSearch
Pub/Sub
Dependency injection using Modules and Services
Proactor pattern service for long-running synchronous work
Task service
Unified microservice API
Automatic API documentation
The REST API is automatically documented using OpenAPI3 standard and the Swagger.
Principles
Write once, use many times
Keep it simple
Well documented
Asynchronous via Python 3 async/await and asyncio
Single-threaded core but compatible with threads
First-class support for containerization
Compatible with pypy, Just-In-Time Python compiler
Kappa architecture
Support for introspection
Modularized
Video tutorial
Licence
ASAB is an open-source software, available under BSD 3-Clause License. ASAB is maintained by TeskaLabs Ltd.
Release files for asab 25.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asab-25.15.tar.gz | 142.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asab-25.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 328.6 kB
Release files / asab-25.15.tar.gz
| Download URL | asab-25.15.tar.gz |
|---|---|
| Size | 142.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43a32ba69573872371921cbd77f79e30b4ff7b7c398167616d04a73e24683b0d
|
|
BLAKE2b-256 checksum How to use checksums |
450519d9a9e04e7e8a09fa3c84649e5b271d55242dc8ca10fa20e8185627b13f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|
Release files / asab-25.15-py3-none-any.whl
| Download URL | asab-25.15-py3-none-any.whl |
|---|---|
| Size | 185.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02264daad128dfad2bffa5d665111f3c15ee4290a18992d489bf764bfba928e0
|
|
BLAKE2b-256 checksum How to use checksums |
1d6acc2030f790da0650cabc2698533878b761dbef604b0a11705436fc4f74e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|