Brinjal
A generic, reusable task management system built with FastAPI and asyncio. Brinjal provides a flexible foundation for building task-based applications with real-time progress updates via Server-Sent Events (SSE).
Features
- Generic Task Management: Base
Taskclass that can be extended for any type of task - Real-time Updates: Server-Sent Events (SSE) for live progress updates
- Asynchronous Execution: Built on asyncio for high-performance task processing
- Flexible Integration: No hardcoded prefixes - easily integrated into any FastAPI application
- Web Components: Reusable frontend components for displaying tasks
- Progress Tracking: Built-in progress monitoring and status updates
Quick Start
Installation
pip install brinjal
Running the Development Server
# Clone the repository
git clone https://github.com/sg-s/brinjal.git
cd brinjal
# Install dependencies
uv sync
# Run the development server
make dev
The server will start at http://localhost:8000.
End-to-End Testing
- Start the server:
make dev - Add a task:
curl -X POST http://localhost:8000/api/tasks/example_task - View the test page: Open
http://localhost:8000/api/tasks/testin your browser - Watch real-time updates: The task will appear and progress in real-time
Usage in Other Projects
Basic Integration
from fastapi import FastAPI
from brinjal.api.router import router as brinjal_router
app = FastAPI()
# Include brinjal with your desired prefix
app.include_router(brinjal_router, prefix="/api/tasks")
Advanced Integration with Custom Endpoints
from fastapi import APIRouter
from brinjal.api.router import router as brinjal_router
from brinjal.manager import task_manager
# Create your main router with the desired prefix
router = APIRouter(prefix="/api/tasks")
# Include all of brinjal's functionality
router.include_router(brinjal_router)
# Add your custom endpoints
@router.post("/custom_task")
async def custom_task():
# Your custom logic here
pass
# Include in your main app
app.include_router(router)
Frontend Integration
<!-- Load the TaskList component from your brinjal endpoint -->
<script src="/api/tasks/static/TaskList.js"></script>
<!-- Use the component -->
<task-list base_url="https://yourdomain.com"></task-list>
API Reference
Core Endpoints
GET /api/tasks/queue- Get all tasksPOST /api/tasks/example_task- Create an example taskGET /api/tasks/{task_id}/stream- Stream task updates via SSEGET /api/tasks/static/{file}- Static files (TaskList.js, etc.)
Data Models
- TaskUpdate: Generic task update model with
task_id,task_type,status,progress,img,heading,body
Development
Running Tests
# Run all tests
make test
# Run specific test suites
make test-task-manager
make test-example-task
# Run with coverage
make test-cov
Building Documentation
make docs
Building the Package
make build
Architecture
Brinjal is designed with separation of concerns in mind:
Task: Base class for all tasks with common functionalityTaskManager: Manages task execution and SSE event generationExampleTask: Concrete implementation demonstrating task patterns- Router: FastAPI router with generic endpoints (no hardcoded prefixes)
- Static Files: Web components and assets for frontend integration
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE.txt for details.
Metadata
Release files for brinjal 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brinjal-0.10.0.tar.gz | 1.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brinjal-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / brinjal-0.10.0.tar.gz
| Download URL | brinjal-0.10.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f472da040e1d2a1f65dcb555f0ac22e322bf0ebc68234f44d0bb5c9f793048cf
|
|
BLAKE2b-256 checksum How to use checksums |
659c6bca7431437840f564153c5508c404404f941997ca56442390de3f214361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / brinjal-0.10.0-py3-none-any.whl
| Download URL | brinjal-0.10.0-py3-none-any.whl |
|---|---|
| Size | 40.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6b61def5c29152ce1c8238471382750345907b55e8838d27b1bd6fd5d021789
|
|
BLAKE2b-256 checksum How to use checksums |
c4a819c58ada4a2f7f192378bc2cb251d0fc63ed967d8018b47d1f2cadeef21d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency log