Repository navigation
Conversation
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
force-pushed
the
types-add-celery-stubs
branch
from
October 11, 2026 01:44
e7ab5b9 to
40cdce4
Compare
cweider
marked this pull request as draft
October 11, 2026 01:45
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. |
Contributor
|
Might be a good opportunity to revisit #5238 as this just adds to the list of issues we already have with Celery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The absence of what should be type errors in #8125 was caused by the lack of annotations from
Celery. Addingcelery-stubswill 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-deployskip-celery-deployskip-cronjob-deployskip-daemon-deployAI Disclosure