Skip to content

Moving monkeypatches into celery #208

@dlucredativ

Description

@dlucredativ

The monkeypatches mentioned in https://github.com/sbdchd/celery-types/blob/main/README.md#install and #157 (comment) are necessary to get rid of Need type annotation for "task" [var-annotated] typecheck errors. There is an open pull-request to get rid of the monkeypatches in the long run, but as I mentioned in that PR, I wonder why the method should not return a Generic.

I suspect that the correct monkeypatch would have been

Celery.__class_getitem__ = classmethod(types.GenericAlias)  # type: ignore[attr-defined]
Task.__class_getitem__ = classmethod(types.GenericAlias)  # type: ignore[attr-defined]
...

Can someone please clarify?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions