brinjal


Namebrinjal JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA generic, reusable task management system built with FastAPI and asyncio
upload_time2025-08-18 19:33:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.13
licenseNone
keywords asyncio fastapi progress-tracking sse task-management
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Brinjal

![](docs/images/hero.gif)

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 `Task` class 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

```bash
pip install brinjal
```

### Running the Development Server

```bash
# 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

1. **Start the server**: `make dev`
2. **Add a task**: `curl -X POST http://localhost:8000/api/tasks/example_task`
3. **View the test page**: Open `http://localhost:8000/api/tasks/test` in your browser
4. **Watch real-time updates**: The task will appear and progress in real-time

## Usage in Other Projects

### Basic Integration

```python
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

```python
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

```html
<!-- 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 tasks
- `POST /api/tasks/example_task` - Create an example task
- `GET /api/tasks/{task_id}/stream` - Stream task updates via SSE
- `GET /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

```bash
# 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

```bash
make docs
```

### Building the Package

```bash
make build
```

## Architecture

Brinjal is designed with separation of concerns in mind:

- **`Task`**: Base class for all tasks with common functionality
- **`TaskManager`**: Manages task execution and SSE event generation
- **`ExampleTask`**: Concrete implementation demonstrating task patterns
- **Router**: FastAPI router with generic endpoints (no hardcoded prefixes)
- **Static Files**: Web components and assets for frontend integration

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request

## License

MIT License - see [LICENSE.txt](LICENSE.txt) for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "brinjal",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.13",
    "maintainer_email": null,
    "keywords": "asyncio, fastapi, progress-tracking, sse, task-management",
    "author": null,
    "author_email": "Srinivas Gorur-Shandilya <code@srinivas.gs>",
    "download_url": "https://files.pythonhosted.org/packages/ee/55/c39a860bdf25127af11946a7bb58be7a6b72d2838eba1f3c7b44a9689fb4/brinjal-0.1.3.tar.gz",
    "platform": null,
    "description": "# Brinjal\n\n![](docs/images/hero.gif)\n\nA 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).\n\n## Features\n\n- **Generic Task Management**: Base `Task` class that can be extended for any type of task\n- **Real-time Updates**: Server-Sent Events (SSE) for live progress updates\n- **Asynchronous Execution**: Built on asyncio for high-performance task processing\n- **Flexible Integration**: No hardcoded prefixes - easily integrated into any FastAPI application\n- **Web Components**: Reusable frontend components for displaying tasks\n- **Progress Tracking**: Built-in progress monitoring and status updates\n\n## Quick Start\n\n### Installation\n\n```bash\npip install brinjal\n```\n\n### Running the Development Server\n\n```bash\n# Clone the repository\ngit clone https://github.com/sg-s/brinjal.git\ncd brinjal\n\n# Install dependencies\nuv sync\n\n# Run the development server\nmake dev\n```\n\nThe server will start at `http://localhost:8000`.\n\n### End-to-End Testing\n\n1. **Start the server**: `make dev`\n2. **Add a task**: `curl -X POST http://localhost:8000/api/tasks/example_task`\n3. **View the test page**: Open `http://localhost:8000/api/tasks/test` in your browser\n4. **Watch real-time updates**: The task will appear and progress in real-time\n\n## Usage in Other Projects\n\n### Basic Integration\n\n```python\nfrom fastapi import FastAPI\nfrom brinjal.api.router import router as brinjal_router\n\napp = FastAPI()\n\n# Include brinjal with your desired prefix\napp.include_router(brinjal_router, prefix=\"/api/tasks\")\n```\n\n### Advanced Integration with Custom Endpoints\n\n```python\nfrom fastapi import APIRouter\nfrom brinjal.api.router import router as brinjal_router\nfrom brinjal.manager import task_manager\n\n# Create your main router with the desired prefix\nrouter = APIRouter(prefix=\"/api/tasks\")\n\n# Include all of brinjal's functionality\nrouter.include_router(brinjal_router)\n\n# Add your custom endpoints\n@router.post(\"/custom_task\")\nasync def custom_task():\n    # Your custom logic here\n    pass\n\n# Include in your main app\napp.include_router(router)\n```\n\n### Frontend Integration\n\n```html\n<!-- Load the TaskList component from your brinjal endpoint -->\n<script src=\"/api/tasks/static/TaskList.js\"></script>\n\n<!-- Use the component -->\n<task-list base_url=\"https://yourdomain.com\"></task-list>\n```\n\n## API Reference\n\n### Core Endpoints\n\n- `GET /api/tasks/queue` - Get all tasks\n- `POST /api/tasks/example_task` - Create an example task\n- `GET /api/tasks/{task_id}/stream` - Stream task updates via SSE\n- `GET /api/tasks/static/{file}` - Static files (TaskList.js, etc.)\n\n### Data Models\n\n- **TaskUpdate**: Generic task update model with `task_id`, `task_type`, `status`, `progress`, `img`, `heading`, `body`\n\n## Development\n\n### Running Tests\n\n```bash\n# Run all tests\nmake test\n\n# Run specific test suites\nmake test-task-manager\nmake test-example-task\n\n# Run with coverage\nmake test-cov\n```\n\n### Building Documentation\n\n```bash\nmake docs\n```\n\n### Building the Package\n\n```bash\nmake build\n```\n\n## Architecture\n\nBrinjal is designed with separation of concerns in mind:\n\n- **`Task`**: Base class for all tasks with common functionality\n- **`TaskManager`**: Manages task execution and SSE event generation\n- **`ExampleTask`**: Concrete implementation demonstrating task patterns\n- **Router**: FastAPI router with generic endpoints (no hardcoded prefixes)\n- **Static Files**: Web components and assets for frontend integration\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass\n6. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE.txt](LICENSE.txt) for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A generic, reusable task management system built with FastAPI and asyncio",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://sg-s.github.io/brinjal",
        "Homepage": "https://github.com/sg-s/brinjal",
        "Issues": "https://github.com/sg-s/brinjal/issues",
        "Repository": "https://github.com/sg-s/brinjal"
    },
    "split_keywords": [
        "asyncio",
        " fastapi",
        " progress-tracking",
        " sse",
        " task-management"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8e7c8e5f9651aeed9f92bc2feccbf5deb14abb30ca550dc5f904f2ff012ac776",
                "md5": "d47beaad578b9955000a2c3c08b4767f",
                "sha256": "43002cc462ff97f2a44e63c8b76095d8ff54eacfc1140e93b9cc6745ee430931"
            },
            "downloads": -1,
            "filename": "brinjal-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d47beaad578b9955000a2c3c08b4767f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.13",
            "size": 24604,
            "upload_time": "2025-08-18T19:33:22",
            "upload_time_iso_8601": "2025-08-18T19:33:22.435556Z",
            "url": "https://files.pythonhosted.org/packages/8e/7c/8e5f9651aeed9f92bc2feccbf5deb14abb30ca550dc5f904f2ff012ac776/brinjal-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ee55c39a860bdf25127af11946a7bb58be7a6b72d2838eba1f3c7b44a9689fb4",
                "md5": "66af6a6689afa3eb4b790b599ce9e0f6",
                "sha256": "02055053662f8eab01c67d92ce97e5e945a84eeafee6ac7a7d8bccb5ea8d0109"
            },
            "downloads": -1,
            "filename": "brinjal-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "66af6a6689afa3eb4b790b599ce9e0f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.13",
            "size": 733166,
            "upload_time": "2025-08-18T19:33:24",
            "upload_time_iso_8601": "2025-08-18T19:33:24.035459Z",
            "url": "https://files.pythonhosted.org/packages/ee/55/c39a860bdf25127af11946a7bb58be7a6b72d2838eba1f3c7b44a9689fb4/brinjal-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 19:33:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sg-s",
    "github_project": "brinjal",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "brinjal"
}
        
Elapsed time: 0.41228s