Patch Detail
Show a patch.
GET /api/patches/16180/?format=api
{ "id": 16180, "url": "https://patchwork.libcamera.org/api/patches/16180/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16180/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220608072418.13154-2-tomi.valkeinen@ideasonboard.com>", "date": "2022-06-08T07:24:15", "name": "[libcamera-devel,v5,1/4] Documentation: Add python-bindings.rst", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "37f6352e638d7876593691a42333c29018df789a", "submitter": { "id": 109, "url": "https://patchwork.libcamera.org/api/people/109/?format=api", "name": "Tomi Valkeinen", "email": "tomi.valkeinen@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16180/mbox/", "series": [ { "id": 3165, "url": "https://patchwork.libcamera.org/api/series/3165/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3165", "date": "2022-06-08T07:24:14", "name": "More misc Python patches", "version": 5, "mbox": "https://patchwork.libcamera.org/series/3165/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16180/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16180/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 21E57C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 8 Jun 2022 07:24:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A89B465643;\n\tWed, 8 Jun 2022 09:24:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D7EC965631\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 8 Jun 2022 09:24:40 +0200 (CEST)", "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DBCAAA58;\n\tWed, 8 Jun 2022 09:24:39 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654673083;\n\tbh=ZerpC6qWLVXQO4+Oe2e1AGXdEBr8pAzdJmXxp8KMZW0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=YtRAcv79PV6g+mwd5UM4XrazT8+KAVMwqwXENflkw8aNaSjvnhtv4dgTXhPqqJMVu\n\t2Kraw6rlWCTI7G4xbamSk3HgTfEo3f1cqtIAsUlUwXvvINYIpCF5++mlGWlT6ulrge\n\t5R9/xXxs6zWMTBZ+bv9WnPuQ3QFQZyNs2MFuqSzT5PRGoy4focvCjWBn4GC158TGp5\n\t5HRn/TlG6umNZOgsQNsAx/rJPVIhyZgl1O2HRpyhqoau/2y2RiJV5ebMRdv1WW5Ypy\n\tiRm8iHrslmKw7jFj4xPA1yxw2OuUqflzhPPzF6AQy7U9urtS22zLkiAm/B9ZuLk9Sl\n\tLOYkiWx6hvBpQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654673080;\n\tbh=ZerpC6qWLVXQO4+Oe2e1AGXdEBr8pAzdJmXxp8KMZW0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=iYX7o/hwubMfB+s5nfR9zRPXHP7jSwzEcDrWnUGnGWq4BKnTPCGBsXu3dHVAAHnNG\n\tw7ZwxLfXubH1FHlwUAR4JGdXHDbuiQ2eJRdFoj69hTE9tg5TZwEc03oWHOEIICKbFb\n\tEO0Oi2a8k+YDFHW70q5GMy6tz+ZXb55Hmj0dID7E=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"iYX7o/hw\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>", "Date": "Wed, 8 Jun 2022 10:24:15 +0300", "Message-Id": "<20220608072418.13154-2-tomi.valkeinen@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220608072418.13154-1-tomi.valkeinen@ideasonboard.com>", "References": "<20220608072418.13154-1-tomi.valkeinen@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 1/4] Documentation: Add\n\tpython-bindings.rst", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a basic doc for the Python bindings. While not really proper\ndocumentation yet, the file and the examples should give enough guidance\nfor users who are somewhat familiar with libcamera.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/index.rst | 1 +\n Documentation/meson.build | 1 +\n Documentation/python-bindings.rst | 69 +++++++++++++++++++++++++++++++\n 3 files changed, 71 insertions(+)\n create mode 100644 Documentation/python-bindings.rst", "diff": "diff --git a/Documentation/index.rst b/Documentation/index.rst\nindex 0ee10044..43d8b017 100644\n--- a/Documentation/index.rst\n+++ b/Documentation/index.rst\n@@ -22,3 +22,4 @@\n Environment variables <environment_variables>\n Sensor driver requirements <sensor_driver_requirements>\n Lens driver requirements <lens_driver_requirements>\n+ Python Bindings <python-bindings>\ndiff --git a/Documentation/meson.build b/Documentation/meson.build\nindex 8e2eacc6..7695bcb1 100644\n--- a/Documentation/meson.build\n+++ b/Documentation/meson.build\n@@ -67,6 +67,7 @@ if sphinx.found()\n 'guides/tracing.rst',\n 'index.rst',\n 'lens_driver_requirements.rst',\n+ 'python-bindings.rst',\n 'sensor_driver_requirements.rst',\n '../README.rst',\n ]\ndiff --git a/Documentation/python-bindings.rst b/Documentation/python-bindings.rst\nnew file mode 100644\nindex 00000000..d59935ae\n--- /dev/null\n+++ b/Documentation/python-bindings.rst\n@@ -0,0 +1,69 @@\n+.. SPDX-License-Identifier: CC-BY-SA-4.0\n+\n+.. _python-bindings:\n+\n+Python Bindings for libcamera\n+=============================\n+\n+*WARNING* The bindings are under work, and the API will change.\n+\n+Differences to the C++ API\n+--------------------------\n+\n+As a rule of thumb the bindings try to follow the C++ API when possible. This\n+chapter lists the differences.\n+\n+Mostly these differences fall under two categories:\n+\n+1. Differences caused by the inherent differences between C++ and Python.\n+These differences are usually caused by the use of threads or differences in\n+C++ vs Python memory management.\n+\n+2. Differences caused by the code being work-in-progress. It's not always\n+trivial to create a binding in a satisfying way, and the current bindings\n+contain simplified versions of the C++ API just to get forward. These\n+differences are expected to eventually go away.\n+\n+Coding Style\n+------------\n+\n+The C++ code for the bindings follows the libcamera coding style as much as\n+possible. Note that the indentation does not quite follow the clang-format\n+style, as clang-format makes a mess of the style used.\n+\n+The API visible to the Python side follows the Python style as much as possible.\n+\n+This means that e.g. ``Camera::generateConfiguration`` maps to\n+``Camera.generate_configuration``.\n+\n+CameraManager\n+-------------\n+\n+The Python API provides a singleton CameraManager via ``CameraManager.singleton()``.\n+There is no need to start or stop the CameraManager.\n+\n+Handling Completed Requests\n+---------------------------\n+\n+The Python bindings do not expose the ``Camera::requestCompleted`` signal\n+directly as the signal is invoked from another thread and it has real-time\n+constraints. Instead the bindings queue the completed requests internally and\n+use an eventfd to inform the user that there are completed requests.\n+\n+The user can wait on the eventfd, and upon getting an event, use\n+``CameraManager.get_ready_requests()`` to clear the eventfd event and to get\n+the completed requests.\n+\n+Controls & Properties\n+---------------------\n+\n+The classes related to controls and properties are rather complex to implement\n+directly in the Python bindings. There are some simplifications in the Python\n+bindings:\n+\n+- There is no ControlValue class. Python objects are automatically converted\n+ to ControlValues and vice versa.\n+- There is no ControlList class. A Python dict with ControlId keys and Python\n+ object values is used instead.\n+- There is no ControlInfoMap class. A Python dict with ControlId keys and\n+ ControlInfo values is used instead.\n", "prefixes": [ "libcamera-devel", "v5", "1/4" ] }