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
pip install celery-pydantic
Usage
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:
uv sync --all-extrasuv run pytest
Requirements
- Python 3.9+
- Celery 5.0+
- Pydantic 2.0+
License
MIT License
Metadata
Release files for celery-pydantic 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| celery_pydantic-1.0.1.tar.gz | 4.4 kB | Without provenance | Details for celery_pydantic-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| celery_pydantic-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for celery_pydantic-1.0.1-py3-none-any.whl |
Total release size: 8.2 kB
Release files / celery_pydantic-1.0.1.tar.gz
| Download URL | celery_pydantic-1.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b746bdf306a574ea9296441fc32d18e9f35cc6e5f07096ae03e422be2b5a54f
|
|
BLAKE2b-256 checksum How to use checksums |
6eaa4d734614a34ceb214f971aa6940d9f7a74f4f1d4026ca2231ed3b5b8ad29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / celery_pydantic-1.0.1-py3-none-any.whl
| Download URL | celery_pydantic-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ce1c0279fe2ea20055f1aa2323fb7069fdd8883b191710fedc726d38f249086
|
|
BLAKE2b-256 checksum How to use checksums |
ed15bea1b41c76f3e9c18fd6ec53f82df2802ce48d8b7f030b4f529d30b7d30b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for celery-pydantic 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.