diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/conf.py | 2 | ||||
| -rw-r--r-- | docs/includes/introduction.txt | 12 | ||||
| -rw-r--r-- | docs/reference/kombu.serialization.rst | 2 | ||||
| -rw-r--r-- | docs/reference/kombu.transport.confluentkafka.rst | 31 | ||||
| -rw-r--r-- | docs/templates/readme.txt | 8 | ||||
| -rw-r--r-- | docs/userguide/serialization.rst | 36 | ||||
| -rw-r--r-- | docs/userguide/simple.rst | 2 |
7 files changed, 69 insertions, 24 deletions
diff --git a/docs/conf.py b/docs/conf.py index 1f781486..0163fe39 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from sphinx_celery import conf globals().update(conf.build_config( diff --git a/docs/includes/introduction.txt b/docs/includes/introduction.txt index f79ef193..36eca4bd 100644 --- a/docs/includes/introduction.txt +++ b/docs/includes/introduction.txt @@ -1,4 +1,4 @@ -:Version: 5.2.0 +:Version: 5.3.0b3 :Web: https://kombu.readthedocs.io/ :Download: https://pypi.org/project/kombu/ :Source: https://github.com/celery/kombu/ @@ -23,15 +23,7 @@ Features * Allows application authors to support several message server solutions by using pluggable transports. - * AMQP transport using the `py-amqp`_, `librabbitmq`_, or `qpid-python`_ libraries. - - * High performance AMQP transport written in C - when using `librabbitmq`_ - - This is automatically enabled if librabbitmq is installed: - - .. code-block:: console - - $ pip install librabbitmq + * AMQP transport using the `py-amqp`_, `redis`_, or `SQS`_ libraries. * Virtual transports makes it really easy to add support for non-AMQP transports. There is already built-in support for `Redis`_, diff --git a/docs/reference/kombu.serialization.rst b/docs/reference/kombu.serialization.rst index 04d7b84a..07ca9bfb 100644 --- a/docs/reference/kombu.serialization.rst +++ b/docs/reference/kombu.serialization.rst @@ -44,8 +44,6 @@ .. autodata:: registry -.. _`cjson`: https://pypi.org/project/python-cjson/ -.. _`simplejson`: https://github.com/simplejson/simplejson .. _`Python 2.7+`: https://docs.python.org/library/json.html .. _`PyYAML`: https://pyyaml.org/ .. _`msgpack`: https://msgpack.org/ diff --git a/docs/reference/kombu.transport.confluentkafka.rst b/docs/reference/kombu.transport.confluentkafka.rst new file mode 100644 index 00000000..3b171a28 --- /dev/null +++ b/docs/reference/kombu.transport.confluentkafka.rst @@ -0,0 +1,31 @@ +========================================================= + confluent-kafka Transport - ``kombu.transport.confluentkafka`` +========================================================= + +.. currentmodule:: kombu.transport.confluentkafka + +.. automodule:: kombu.transport.confluentkafka + + .. contents:: + :local: + + Transport + --------- + + .. autoclass:: Transport + :members: + :undoc-members: + + Channel + ------- + + .. autoclass:: Channel + :members: + :undoc-members: + + Message + ------- + + .. autoclass:: Message + :members: + :undoc-members: diff --git a/docs/templates/readme.txt b/docs/templates/readme.txt index 05b8edb0..55175ca2 100644 --- a/docs/templates/readme.txt +++ b/docs/templates/readme.txt @@ -10,12 +10,12 @@ .. include:: ../includes/resources.txt -.. |build-status| image:: https://secure.travis-ci.org/celery/kombu.png?branch=master +.. |build-status| image:: https://github.com/celery/kombu/actions/workflows/ci.yaml/badge.svg :alt: Build status - :target: https://travis-ci.org/celery/kombu + :target: https://github.com/celery/kombu/actions/workflows/ci.yml -.. |coverage| image:: https://codecov.io/github/celery/kombu/coverage.svg?branch=master - :target: https://codecov.io/github/celery/kombu?branch=master +.. |coverage| image:: https://codecov.io/github/celery/kombu/coverage.svg?branch=main + :target: https://codecov.io/github/celery/kombu?branch=main .. |license| image:: https://img.shields.io/pypi/l/kombu.svg :alt: BSD License diff --git a/docs/userguide/serialization.rst b/docs/userguide/serialization.rst index 711bedd9..f8523e69 100644 --- a/docs/userguide/serialization.rst +++ b/docs/userguide/serialization.rst @@ -32,23 +32,45 @@ The accept argument can also include MIME-types. Each option has its advantages and disadvantages. -`json` -- JSON is supported in many programming languages, is now - a standard part of Python (since 2.6), and is fairly fast to - decode using the modern Python libraries such as `cjson` or - `simplejson`. +`json` -- JSON is supported in many programming languages, is + a standard part of Python, and is fairly fast to + decode. The primary disadvantage to `JSON` is that it limits you to the following data types: strings, Unicode, floats, boolean, - dictionaries, and lists. Decimals and dates are notably missing. + dictionaries, lists, decimals, DjangoPromise, datetimes, dates, + time, bytes and UUIDs. + + For dates, datetimes, UUIDs and bytes the serializer will generate + a dict that will later instruct the deserializer how to produce + the right type. Also, binary data will be transferred using Base64 encoding, which will cause the transferred data to be around 34% larger than an - encoding which supports native binary types. + encoding which supports native binary types. This will only happen + if the bytes object can't be decoded into utf8. However, if your data fits inside the above constraints and you need cross-language support, the default setting of `JSON` is probably your best choice. + If you need support for custom types, you can write serialize/deserialize + functions and register them as follows: + + .. code-block:: python + + from kombu.utils.json import register_type + from django.db.models import Model + from django.apps import apps + + # Allow serialization of django models: + register_type( + Model, + "model", + lambda o: [o._meta.label, o.pk], + lambda o: apps.get_model(o[0]).objects.get(pk=o[1]), + ) + `pickle` -- If you have no desire to support any language other than Python, then using the `pickle` encoding will gain you the support of all built-in Python data types (except class instances), @@ -67,7 +89,7 @@ Each option has its advantages and disadvantages. to limit access to the broker so that untrusted parties do not have the ability to send messages! - By default Kombu uses pickle protocol 2, but this can be changed + By default Kombu uses pickle protocol 4, but this can be changed using the :envvar:`PICKLE_PROTOCOL` environment variable or by changing the global :data:`kombu.serialization.pickle_protocol` flag. diff --git a/docs/userguide/simple.rst b/docs/userguide/simple.rst index 8d86711c..41daae52 100644 --- a/docs/userguide/simple.rst +++ b/docs/userguide/simple.rst @@ -61,7 +61,7 @@ to produce and consume logging messages: from kombu import Connection - class Logger(object): + class Logger: def __init__(self, connection, queue_name='log_queue', serializer='json', compression=None): |
