From 4281f5749b554f4d70947257d65abfda18386402 Mon Sep 17 00:00:00 2001 From: "Adam (indoor47)" Date: Fri, 27 Feb 2026 05:57:27 +0000 Subject: [PATCH 1/2] docs: replace deprecated ujson with orjson in documentation Fixes #10795. The ujson library has been placed in maintenance-only mode by its maintainers who recommend migrating to orjson. Updated the client quickstart example to use orjson via the json_serialize_bytes parameter, which is the correct integration path since orjson.dumps returns bytes rather than str. --- CHANGES/10795.doc.rst | 4 ++++ docs/client_quickstart.rst | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 CHANGES/10795.doc.rst diff --git a/CHANGES/10795.doc.rst b/CHANGES/10795.doc.rst new file mode 100644 index 00000000000..91094f70c13 --- /dev/null +++ b/CHANGES/10795.doc.rst @@ -0,0 +1,4 @@ +Replaced the deprecated ``ujson`` library with ``orjson`` in the +client quickstart documentation. ``ujson`` has been put into +maintenance-only mode; ``orjson`` is the recommended alternative. +-- by :user:`indoor47` diff --git a/docs/client_quickstart.rst b/docs/client_quickstart.rst index fc6d3875ea1..1ab5610b824 100644 --- a/docs/client_quickstart.rst +++ b/docs/client_quickstart.rst @@ -206,20 +206,22 @@ Any of session's request methods like :func:`request`, By default session uses python's standard :mod:`json` module for -serialization. But it is possible to use different -``serializer``. :class:`ClientSession` accepts ``json_serialize`` -parameter:: +serialization. But it is possible to use a different +``serializer``. :class:`ClientSession` accepts ``json_serialize`` and +``json_serialize_bytes`` parameters:: - import ujson + import orjson async with aiohttp.ClientSession( - json_serialize=ujson.dumps) as session: + json_serialize_bytes=orjson.dumps) as session: await session.post(url, json={'test': 'object'}) .. note:: - ``ujson`` library is faster than standard :mod:`json` but slightly - incompatible. + ``orjson`` library is faster than standard :mod:`json` and is actively + maintained. Since ``orjson.dumps`` returns :class:`bytes`, pass it via + the ``json_serialize_bytes`` parameter to avoid unnecessary + encoding/decoding overhead. JSON Response Content ===================== From 6690d0c191a11b9b7200b2da47d7ef3d80a723d5 Mon Sep 17 00:00:00 2001 From: indoor47 Date: Fri, 27 Feb 2026 07:16:12 +0100 Subject: [PATCH 2/2] fix: add 'quickstart' to spelling wordlist --- docs/spelling_wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 9890b228e01..365e99c3747 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -266,6 +266,7 @@ pytest Pytest qop Quickstart +quickstart quote’s rc readline