Skip to content

chore(types): add stubs for celery - #8136

Closed
cweider wants to merge 4 commits into
freelawproject:mainfrom
cweider:types-add-celery-stubs
Closed

cweider wants to merge 4 commits into
freelawproject:mainfrom
cweider:types-add-celery-stubs

Conversation

@cweider

@cweider cweider commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The absence of what should be type errors in #8125 was caused by the lack of annotations from Celery. Adding celery-stubs will bump the baseline, but aid the identification of problems.

The stubs shake out several substantive errors: an argument count mismatch and bad types. These require “interesting refactoring” and are best addressed as a stand-alone change. This branch only includes the small, minor fixes.

This PR should:

  • skip-deploy (skips everything below)
    • skip-web-deploy
    • skip-celery-deploy
    • skip-cronjob-deploy
    • skip-daemon-deploy

AI Disclosure

  • No AI tools were used to create the content of this PR.
  • Parts of this PR were created with the help of an AI tool, and I have carefully reviewed all of its content and take full responsibility for it.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

The absence of what should be type errors in freelawproject#8125 was caused by
the lack of annotations from `Celery`. Adding stubs for celery
will bump the baseline, but catch issues. Considering how heavily
used Celery is, the checking is worthwhile.

There are two stub projects, `celery-stubs` and `celery-types`.
`-stubs` is mostly abandoned. `celery-types` is more recent - the
latter seems like the better of the options.
`app.Task` is a function (that returns a class) and not a type.
The class produced by this function is special subclass of
`Task`, but this is unimportant to the callers of the methods
in question. `celery.Task` is an appropriate type to use.
The docstring specifies a tuple; it is easy to accomodate.
@cweider cweider changed the title Types add celery stubs chore(types): add stubs for celery Oct 11, 2026
@cweider
cweider force-pushed the types-add-celery-stubs branch from e7ab5b9 to 40cdce4 Compare October 11, 2026 01:44
@cweider
cweider marked this pull request as draft October 11, 2026 01:45
@cweider

cweider commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Posted as a draft, the stubs thing needs a close look. I don’t like that it’s not very official and there’s something it does with making up generics that call for monkey-patching bits of Celery. This is something to take slow and perhaps only use out-of-band during type refactoring.

@MorganBennetDev MorganBennetDev self-assigned this Oct 11, 2026
@MorganBennetDev MorganBennetDev added this to the 100% Type Coverage milestone Oct 11, 2026
@MorganBennetDev

Copy link
Copy Markdown
Contributor

Might be a good opportunity to revisit #5238 as this just adds to the list of issues we already have with Celery

@cweider cweider closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants