{"id":16019,"url":"https://patchwork.libcamera.org/api/1.1/patches/16019/?format=json","web_url":"https://patchwork.libcamera.org/patch/16019/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>","date":"2022-05-24T11:46:05","name":"[libcamera-devel,v2,14/19] py: Add README.md","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6f12e6717028e15cf9488c1cac0adfc626b56590","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/1.1/people/109/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16019/mbox/","series":[{"id":3134,"url":"https://patchwork.libcamera.org/api/1.1/series/3134/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3134","date":"2022-05-24T11:45:51","name":"More misc Python patches","version":2,"mbox":"https://patchwork.libcamera.org/series/3134/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16019/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16019/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 E14D4C326D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 May 2022 11:46:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9765465689;\n\tTue, 24 May 2022 13:46:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D5786567A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 May 2022 13:46:37 +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 CB2EF8DC;\n\tTue, 24 May 2022 13:46:36 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653392811;\n\tbh=Ed51yMM7FH3fIuTwVwblqVMwAFno1yWPdeEfEuUFOKM=;\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=aR+ivw5CTyi4nJCgdg5pqjQW6iwOYiI3uG8kIRWbs7sGl1ft3u+DgFzBlNwxbJQTX\n\tGUN5SS24isXBoZChd87eRdOm6S9f4jaEJ/9RNg84b/Op31DbxivszJAuc4zxYbBCJW\n\trfXpE5u0B/fqdCL7ttdsJfnlgNs/YYvew5lD0L3nP3wBSkOn4sqgmcfEFC4YUe8xeX\n\t0MofGFXVtLpLfaCNuQcBw0Qn9KHfu788dguSVaIL5C0jQE3AHnFbF5ox1GhjLBbia6\n\toq06Mg44Rg7Y0rhy/h8pwy4paoEGB+fkgob2QwqK+o/zQrLLUug4YCv8+r6Tfca/FA\n\tIQb12seKB4QwQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653392797;\n\tbh=Ed51yMM7FH3fIuTwVwblqVMwAFno1yWPdeEfEuUFOKM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HUhx8KvIMnJmzbtinj+V+r2VQCcXudXTcceUVx2CE4AHKwqfpp8KK7bjuwuVIUhLb\n\tc9kaL7E4GdHlNAYTtx3K9oB+bcIl2EGfDpiuenlWKvgMrKQHPeqqFXDpg+kahd479G\n\tbhxY4/dwNPBWyg66D214ku8PtMHNDLRXD9ebNvtQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"HUhx8KvI\"; 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":"Tue, 24 May 2022 14:46:05 +0300","Message-Id":"<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>","References":"<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 14/19] py: Add README.md","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 README for the Python bindings. While not a proper doc, the\nREADME and the examples should give enough guidance for users who are\nsomewhat familiar with libcamera.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 61 insertions(+)\n create mode 100644 src/py/README.md","diff":"diff --git a/src/py/README.md b/src/py/README.md\nnew file mode 100644\nindex 00000000..0a763030\n--- /dev/null\n+++ b/src/py/README.md\n@@ -0,0 +1,61 @@\n+# Python Bindings for libcamera\n+\n+*WARNING* The bindings are under work, and the API will change.\n+\n+## Differences to the C++ API\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+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 Python side follows 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+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+The Python bindings does 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 will internally queue the completed\n+requests and use an eventfd to inform the user that there are completed\n+requests.\n+\n+The user can wait on the eventfd, and upon getting an event, use\n+CameraManager.read_event() to clear the eventfd event and\n+CameraManager.get_ready_requests() to get the completed requests.\n+\n+### Controls & Properties\n+\n+The classes related to controls and properties are rather complex to implement\n+directly in the Python bindings. There are some simplifications on 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+\n","prefixes":["libcamera-devel","v2","14/19"]}