Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 82.4MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 3.5s · import 0.000s · 81MB
80MB installed
● package 80MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Celery
✓ from celery import Celery
✗ from celery_stubs import Celery
This quickstart demonstrates a basic Celery application using type hints. With `celery-stubs` installed, a static type checker like MyPy can validate the type annotations within your Celery tasks and interactions with Celery objects, helping catch type-related errors before runtime.
import os
from celery import Celery
from typing import Dict, Any
# Configure Celery (replace with your actual broker/backend if running)
app = Celery(
'my_app',
broker=os.environ.get('CELERY_BROKER_URL', 'redis://localhost:6379/0'),
backend=os.environ.get('CELERY_RESULT_BACKEND', 'redis://localhost:6379/0')
)
@app.task
def add(x: int, y: int) -> int:
return x + y
@app.task
def process_data(data: Dict[str, Any]) -> None:
print(f"Processing: {data['value']}")
# To demonstrate type checking, you would typically run mypy:
# mypy your_script_name.py
# If celery-stubs is installed, mypy will use it to validate types
# related to Celery objects (e.g., app.task decorator, AsyncResult, etc.)
# Example of type-hinted usage (not directly runnable without a Celery worker):
if __name__ == "__main__":
result = add.delay(1, 2)
print(f"Task ID: {result.id}")
# result_value: int = result.get() # This line would be type-checked by mypy
# Example of incorrect usage that mypy would catch with stubs:
# bad_result = add.delay('a', 'b') # mypy would flag this as type error
Debug
Known issues
gotchaThis package provides *only* type stubs (`.pyi` files) for static analysis and does not add any runtime functionality or client-side proxy behavior to Celery. It is purely for enhancing type checking capabilities.fixUnderstand that `celery-stubs` is a development dependency for type checking, not a runtime dependency.
affects: All versions
gotchaThe `celery-stubs` package is currently in '3 - Alpha' development status. This indicates that its API might not be stable, and future minor versions could introduce breaking changes.fixPin the version of `celery-stubs` in your project's dependencies to prevent unexpected breaking changes, e.g., `celery-stubs==0.1.3`.
affects: All versions (0.1.x)
gotchaFor more comprehensive and actively maintained type stubs covering the broader Celery ecosystem (including `amqp`, `kombu`, `billiard`, etc.), consider using the `celery-types` package by `sbdchd` instead. It appears to be more actively developed and widely used.fixEvaluate `celery-types` (`pip install celery-types`) as a potential alternative if `celery-stubs` does not meet your type-hinting needs for the full Celery ecosystem.
affects: All versions
Upgrade
Version history
0.1.3latest on PyPI · released Feb 10, 2023
Audit
Dependencies
No dependency data recorded yet.