Type stubs for celery related projects:
pip install celery-typesYou'll also need to monkey patch the classes from the example below (you can delete anything you don't intend to use) so generic params can be provided:
fromceleryimportCelery, Signaturefromcelery.app.taskimportTaskfromcelery.contrib.abortableimportAbortableAsyncResult, AbortableTaskfromcelery.contrib.django.taskimportDjangoTaskfromcelery.localimportclass_propertyfromcelery.resultimportAsyncResultfromcelery.utils.objectsimportFallbackContextclasses= [
Celery,
Task,
DjangoTask,
AbortableTask,
AsyncResult,
AbortableAsyncResult,
Signature,
FallbackContext,
class_property,
]
forclsinclasses:
setattr( # noqa: B010cls,
"__class_getitem__",
classmethod(lambdacls, *args, **kwargs: cls),
)# install uv (https://docs.astral.sh/uv/)
curl -LsSf https://astral.sh/uv/install.sh | shuv sync# run formatting, linting, and typechecking
s/lintor
uv run ruff check --fix
uv run ruff format
uv run basedpyright typings tests
uv run mypy tests
uv run ty typings tests# build and publish
uv build && uv publishThe project uses pre-commit for code quality checks:
# install pre-commit hooks
uv run prek install
# run all checks manually
uv run prek run --all-files- ruff — formatting and linting
- basedpyright — type checking
- mypy — type checking
- ty — type checking