Skip to main content

Create a event driven architecture with garlic improve your development experience

Project description

🧄 Garlic

Craft powerful Event-Driven Architectures (EDA) in Python, effortlessly. With Garlic, respond to app events, like user actions, in a snap.

Why Garlic?

Simple, Yet Robust: Drawing inspiration from tools like Celery and FastAPI, Garlic brings a fresh approach to EDA, making it approachable without sacrificing power.

  • 🚀 EDA Simplified: Want actions like email notifications or newsletter sign-ups after a user registers? Garlic streamlines these event-driven responses.
  • 📦 FastAPI Inspired: Just as FastAPI made web APIs intuitive, Garlic aims to demystify EDA.
  • 🔍 Beyond Regular Tasks: While Celery is a go-to for background tasks, Garlic emphasizes responding to events.
  • 📝 Typed and Transparent: Using Python typings, understand and control the data in your events.
  • 🔌 Flexible & Extendable: Adapt and grow Garlic according to your needs.

Coming Soon

📖 Visual Event Flows: We're building tools to visually map out your event-driven pathways, similar to how web routes are displayed in some platforms.

Get Started

  1. Install:
pip install garlic
  1. Dive In: FastAPI integration example
  • Create a file main.py with:
from fastapi import FastAPI
from garlic import Garlic, BaseEvent

bus = Garlic()

api = FastApi()


class CustomerRegisteredEvent(BaseEvent):
    name: str


@bus.subscribe()
def send_email(event: CustomerRegisteredEvent):
    pass


@bus.subscribe()
def subscribe_to_newsletter(event: CustomerRegisteredEvent):
    pass


@api.route('customer/register/')
def register_user(user: dict):
    # .... business logics  ....
    bus.emit(CustomerRegisteredEvent(
        name=user['name']
    ))
    # ... http response ...
  • Run the app with uvicorn main:api --reload
  • Send a POST request to http://localhost:8000/customer/register/ with a JSON body like {"name": "Uriel Reina"}
  • Check the terminal to see the event being published and handled by the subscribers

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

garlic-0.5.0a0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

garlic-0.5.0a0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file garlic-0.5.0a0.tar.gz.

File metadata

  • Download URL: garlic-0.5.0a0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/22.3.0

File hashes

Hashes for garlic-0.5.0a0.tar.gz
Algorithm Hash digest
SHA256 cda500a7f147e551ebb3f9f65690bd62f5541ede69b78c842b318c9e8706ba6a
MD5 4f59215d126761936239ca7ac3726b0a
BLAKE2b-256 6cb30ad5f90653305bd07b4ad9eb52c370f87df704669143e968257a48eaf6e6

See more details on using hashes here.

File details

Details for the file garlic-0.5.0a0-py3-none-any.whl.

File metadata

  • Download URL: garlic-0.5.0a0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/22.3.0

File hashes

Hashes for garlic-0.5.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4b8031a5632644e7a5218fc4a4a585a08b6d50ee30522612972dc91ec3e8530
MD5 1ca055a89cd3455041aca1e16ace58c0
BLAKE2b-256 79cdd26749629d02a149ab9da9f106304a5b6078da4cc5047d06a77c8e946519

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