Metadata-Version: 2.4
Name: celery-pydantic
Version: 1.0.1
Summary: A library for serializing Pydantic models in Celery tasks
Home-page: https://github.com/jwnwilson/celery_pydantic
Author: Noel Wilson
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: celery>=5.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: kombu>=5.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Celery Pydantic

A library that provides seamless integration between Celery and Pydantic models, allowing you to serialize and deserialize Pydantic models in Celery tasks.

## Installation

```bash
pip install celery-pydantic
```

## Usage

```python
from celery import Celery
from pydantic import BaseModel
from celery_pydantic import pydantic_celery

# Define your Pydantic model
class User(BaseModel):
    name: str
    age: int

# Create your Celery app
app = Celery('myapp', broker='amqp://')

# Configure the app to use Pydantic serialization
pydantic_celery(app)

# Use Pydantic models in your tasks
@app.task
def process_user(user: User):
    return user.name

# Call the task with a Pydantic model
user = User(name="John", age=30)
result = process_user.delay(user)
```

## Features

- Automatic serialization and deserialization of Pydantic models in Celery tasks
- Support for nested Pydantic models
- Maintains type safety throughout the task execution
- Compatible with Celery's result backend

## Testing

To run the tests locally:

1. `uv sync --all-extras`
2. `uv run pytest`

## Requirements

- Python 3.9+
- Celery 5.0+
- Pydantic 2.0+

## License

MIT License 
