Skip to content

Conversation

@federicobond
Copy link
Contributor

@federicobond federicobond commented Dec 19, 2025

I wrote stubs for the Django Task framework introduced in Django 6.0. They still need some polish but feedback is very welcome.

If you are reviewing this, pay special attention to the Task class generic parameters which have an influence in how many other methods are typed.

Update: this now passes all tests, I had to put some items in the allowlist and conditionally monkeypatch the tasks classes based on the Django version. There are some rough edges there, but things are looking good.

@federicobond federicobond force-pushed the tasks-stubs branch 9 times, most recently from 3474fed to 91cba97 Compare December 19, 2025 19:45
@federicobond federicobond marked this pull request as ready for review December 19, 2025 20:08
@intgr intgr changed the title Add stubs for Django Tasks framework Django 6.0: Add Django Tasks framework Dec 22, 2025
@intgr intgr added this to the Django 6.0 support milestone Dec 22, 2025
@intgr intgr self-requested a review December 22, 2025 09:21
django.tasks.checks
django.tasks.exceptions
django.tasks.signals
django.tasks.default_task_backend
Copy link
Member

Choose a reason for hiding this comment

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

Question: why are these items in todo.txt?

  • If these are expected errors, move them to regular allowlist.txt (without todo) and comment why they are here
  • If they are just not fixed yet, what is blocking us from fixing them?

Copy link
Contributor Author

@federicobond federicobond Dec 26, 2025

Choose a reason for hiding this comment

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

Honestly because I wasn't aware of how to use each list, so I just threw those items back to where they came from.

  • django.tasks.default_task_backend could be moved to allowlist_todo.txt with the other ConnectionProxy instances, like django.core.cache.cache and django.db.connection.
  • django.tasks.task decorator emits an error because one of the overloads expects a non-None function value when the decorator accepts None at runtime (for the other overload). Could move it to allowlist.txt
  • django.tasks.backends.base.BaseTaskBackend.enqueue should be typed as an abstract method but not sure if that's going to be problematic since default_task_backend is typed as BaseTaskBackend. Can move it to allowlist.txt but not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants