This project has been archived by its maintainers, and is no longer receiving any updates.
Celery Decorator taskcls
- Free software: MIT License
This package is temporary way to get app.taskcls decorator right now.
The main target of this package make you able to use taskcls decorator
before celery 4.5 released, and then you can remove this package import
without application code change
More about: https://github.com/celery/celery/pull/5755
Features
import celery_decorator_taskcls
celery_decorator_taskcls.patch_celery()
from celery import Celery
app = Celery(...)
class BaseTask:
def __init__(self, task, **kwargs):
self.task = task
for key, value in kwargs.items():
setattr(self, key, value)
@classmethod
def task(cls, task, **kwargs):
instance = cls(task, **kwargs)
return instance.main()
@app.taskcls(bind=True)
class SimpleTask(BaseTask):
def main(self):
...
app.taskcls decorator behavior is the same as app.task. You can pass it
kwargs like bind, name or other or you can use it without kwargs
You can also pass default decorator options by nested class MetaTask:
class BaseTask:
class MetaTask:
bind = True
@classmethod
def task(cls, taks, *args, **kwargs):
...
Patching options
By default patcher search Celery.taskcls attribute. If it not found, patcher
creates it. But when it exists (I belive you find it in Celery 4.5), patcher
checks its optional argument force, because it seems patching not required.
Calling celery_decorator_taskcls.patch_celery(force=True) enforces
patching Celery even Celery.taskcls exists
Changelog
[0.1.4]
- Allow to inherit taskcls from another taskcls
- Comment code blocks to simplify its understanding
[0.1.3]
- Fix MetaTask inheritance
[0.1.2]
- Update Readme
[0.1.1]
- Add chandelog
- Rename nested class
MetatoMetaTask
[0.1.0]
- Initial commit
Metadata
Release files for celery-decorator-taskcls 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| celery-decorator-taskcls-0.1.4.tar.gz | 3.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| celery_decorator_taskcls-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / celery-decorator-taskcls-0.1.4.tar.gz
| Download URL | celery-decorator-taskcls-0.1.4.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd1ad58f03ff2575bf09365d2765215b77d2cd6ddaa91e920b19fdba08ba630
|
|
BLAKE2b-256 checksum How to use checksums |
eb8b5899fdad26627221211036e4c34e23f13beeb5fcfad0567810eaf5290aad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
|
Release files / celery_decorator_taskcls-0.1.4-py3-none-any.whl
| Download URL | celery_decorator_taskcls-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7e3be4d1b57bad901b31ed55ed2f875d5e0ce01ed7c8b8c5c751e77486eb47e
|
|
BLAKE2b-256 checksum How to use checksums |
be757b6cf78f88b3b65f601f8e5058e8ffa83541ec923e2a107b39c7ff806a07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
|
Security for celery-decorator-taskcls 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.