Unfreeze tasks class
- Dominant language
- No language data
- Stars
- 188
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
### Code of Conduct
- [x] I agree to follow Django's Code of Conduct
### Feature Description
Unfreezing tasks can improve versatility for custom task implementations and subclasses. Tasks are instantiated during module loading as quasi singletons. People can better use inheritance or even do in-place updates with decorators. Attribute read performance could be improved by slotting them.
### Problem
Based on this forum discussion: https://forum.djangoproject.com/t/tasks-framework-versatility-performance/45035
TL;DR: Frozen dataclasses can't be easily modified during runtime. This is extra true for decorators. A practical example from [django-crontask](https://github.com/codingjoe/django-crontask) was that I wanted to attach the schedule to a task instance while being task backend/task agnostic.
cc @RealOrangeOne
### Request or proposal
proposal
### Additional Details
_No response_
### Implementation Suggestions
While freezing task results makes sense architecturally (even though they are updated in place via `refresh`) the same argument doesn't extend to Task singletons. Freezing only makes it harder for people to go wild and build amazing things. :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.