Registry / type-stubs / celery-stubs

celery-stubs

JSON →
library0.1.3pypypiunverified

celery-stubs provides type hints for the popular Celery distributed task queue, allowing static type checkers like MyPy to validate Celery-related code. This package is currently at version 0.1.3, released in February 2023, and exhibits a slow, infrequent release cadence.

pip install celery-stubs
INSTALL
IMPORT
SIG · CELERY-STUBS
C
celery-stubs
type-stubspythonv0.1.3
Install
3.5s avg
Import
Disk
80MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 82.4MB
glibc
py 3.103.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.
fix
Understand 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.
fix
Pin 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.
fix
Evaluate `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.

Agent activity
45 hits · last 30 days
node
38
OpenAI (training)
1
Resources
celery-stubs — pip install celery-stubs · libregistry