Metadata-Version: 2.1
Name: jararaca
Version: 0.1.6
Summary: A simple and fast API framework for Python
Home-page: https://github.com/LuscasLeo/jararaca
Author: Lucas S
Author-email: me@luscasleo.dev
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: aio-pika (>=9.4.3,<10.0.0)
Requires-Dist: croniter (>=3.0.3,<4.0.0)
Requires-Dist: fastapi (>=0.113.0,<0.114.0)
Requires-Dist: redis (>=5.0.8,<6.0.0)
Requires-Dist: sqlalchemy (>=2.0.34,<3.0.0)
Requires-Dist: uvicorn (>=0.30.6,<0.31.0)
Requires-Dist: uvloop (>=0.20.0,<0.21.0)
Requires-Dist: websockets (>=13.0.1,<14.0.0)
Project-URL: Repository, https://github.com/LuscasLeo/jararaca
Description-Content-Type: text/markdown

<img src="docs/assets/_f04774c9-7e05-4da4-8b17-8be23f6a1475.jpeg" alt="README.md" width="250" float="right">

# 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](https://fastapi.tiangolo.com/) 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](https://aio-pika.readthedocs.io/) as the message broker worker and publisher.

## Installation

```bash
pip install jararaca
```

## Usage


### Create a Microservice
```python
# 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)

```

### Run as a Web Server
```bash
uvicorn app:web_app --reload
# or
jararaca server app:app
```

### Run as a Message Bus Worker
```bash
jararaca worker app:app
```

