Skip to content

chore: apply static type checks on celery async task dispatches and imports#24418

Merged
crazywoola merged 10 commits intolanggenius:mainfrom
bowenliang123:celery-types
Aug 24, 2025
Merged

chore: apply static type checks on celery async task dispatches and imports#24418
crazywoola merged 10 commits intolanggenius:mainfrom
bowenliang123:celery-types

Conversation

@bowenliang123
Copy link
Copy Markdown
Contributor

@bowenliang123 bowenliang123 commented Aug 24, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • to close missing type checks on celery async task and imports #24417
  • install celery-types lib for stubs of celery and related libraires
  • bump mypy to 1.17
  • correct the setting of task_ignore_result config from Celery app initialisation to config updates
  • and fix the following errors in mypy checks after installing celery-types lib
extensions/ext_celery.py:64: error: Unexpected keyword argument "task_ignore_result" for "Celery"  [call-arg]
services/webapp_auth_service.py:77: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:442: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:470: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:473: error: Argument "phase" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:490: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:514: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:517: error: Argument "workspace" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:536: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:538: error: Argument "workspace" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:539: error: Argument "new_owner_email" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:555: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:557: error: Argument "workspace" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:651: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
services/account_service.py:1266: error: Argument "language" to "delay" of "Task" has incompatible type "str | None"; expected "str"  [arg-type]
events/event_handlers/clean_when_document_deleted.py:11: error: Argument 2 to "delay" of "Task" has incompatible type "Any | None"; expected "str"  [arg-type]
events/event_handlers/clean_when_document_deleted.py:11: error: Argument 3 to "delay" of "Task" has incompatible type "Any | None"; expected "str"  [arg-type]

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 24, 2025
@bowenliang123 bowenliang123 changed the title chore: apply static type checks on celery async task and imports chore: apply static type checks on celery async task dispaches and imports Aug 24, 2025
@bowenliang123 bowenliang123 changed the title chore: apply static type checks on celery async task dispaches and imports chore: apply static type checks on celery async task dispatches and imports Aug 24, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 24, 2025
@crazywoola crazywoola merged commit d800025 into langgenius:main Aug 24, 2025
9 checks passed
qiaofenlin pushed a commit to qiaofenlin/dify that referenced this pull request Aug 24, 2025
@lyzno1 lyzno1 mentioned this pull request Aug 25, 2025
qiqizjl pushed a commit to qiqizjl/dify that referenced this pull request Aug 27, 2025
@bowenliang123 bowenliang123 deleted the celery-types branch August 28, 2025 08:48
HarryReidx pushed a commit to HarryReidx/dify that referenced this pull request Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing type checks on celery async task and imports

2 participants