A simple and fast API framework for Python
Project description
Jararaca Microservice Framework
Overview
Jararaca is a aio-first microservice framework that provides a set of tools to build and deploy microservices in a simple and clear way.
Features
Hexagonal Architecture
The framework is based on the hexagonal architecture, which allows you to separate the business logic from the infrastructure, making the code more testable and maintainable.
Dependency Injection
The framework uses the dependency injection pattern to manage the dependencies between the components of the application.
Web Server Port
The framework provides a web server that listens on a specific port and routes the requests to the appropriate handler. It uses FastAPI as the web framework.
Message Bus
The framework provides a message bus that allows you to send messages between the components of the application. It uses AIO Pika as the message broker worker and publisher.
Installation
pip install jararaca
Usage
Create a Microservice
# app.py
from jararaca import Microservice, create_http_server, create_messagebus_worker
app = Microservice(
providers=[
ProviderSpec(
provide=Token[AppConfig],
use_factory=AppConfig.provider,
)
],
controllers=[TasksController],
interceptors=[
AIOSqlAlchemySessionInterceptor(
AIOSQAConfig(
connection_name="default",
url="sqlite+aiosqlite:///db.sqlite3",
)
),
],
)
web_app = create_http_server(app)
messagebus_worker = create_messagebus_worker(app)
Run as a Web Server
uvicorn app:web_app --reload
Run as a Message Bus Worker
jararaca worker app:messagebus_worker
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jararaca-0.1.2a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc6799b51d47d58ebb237c366364830c467ceb5f1cb886c7aaeca1012b951083 |
|
MD5 | 3903da8b565cd4a0e37eec4b27a0015a |
|
BLAKE2b-256 | e6d68532256e3c745ae1607601c2c7ccc9507d9dc18fefc7d2e7996d86b51973 |