[{"id":23182,"web_url":"https://patchwork.libcamera.org/comment/23182/","msgid":"<YpCEd1ofWqEtBK6i@pendragon.ideasonboard.com>","date":"2022-05-27T07:57:43","subject":"Re: [libcamera-devel] [PATCH v2 14/19] py: Add README.md","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Tue, May 24, 2022 at 02:46:05PM +0300, Tomi Valkeinen wrote:\n> Add a basic README for the Python bindings. While not a proper doc, the\n> README and the examples should give enough guidance for users who are\n> somewhat familiar with libcamera.\n> \n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  src/py/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++\n\nShould this go to Documentation/python.md ?\n\n>  1 file changed, 61 insertions(+)\n>  create mode 100644 src/py/README.md\n> \n> diff --git a/src/py/README.md b/src/py/README.md\n> new file mode 100644\n> index 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\ns/to Python side/to the Python side/\ns/Python style/the Python style/\n\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\ns/does/do/\n\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\nYou can drop this blank line.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>","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 85CFBBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 07:57:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DD856633A1;\n\tFri, 27 May 2022 09:57:50 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5401F60415\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 09:57:49 +0200 (CEST)","from pendragon.ideasonboard.com (ip-109-40-242-63.web.vodafone.de\n\t[109.40.242.63])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7FF9A31A;\n\tFri, 27 May 2022 09:57:48 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653638270;\n\tbh=DOqx0Eq7VDz8sdZYlHs1mi+q4mUISIlWcAcxQwYkgpU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=z9c41m/jJq3KFDFufv3qpYXj5LXS01CM94mzHm4oUlmomE5XBuGIsYR006Wng5OBn\n\tYLWTbvqpFK5Dg2U+Jgulutmd0T/vkmYfJbd6TBky3Av8NF1xLTQlXycJ4/HL7byG3N\n\ttr6llxrSQJn/WC3SHzMAHnp0J+3ITHkeq67kkfcaLGmoC8qpG65f239RjviF0VgCRf\n\tlltvLw8gZfMUqK1BOz6+trxJPW4lQdvWwLK/7wJjwoZZNIHhMsF6JihqlHO/4spR2M\n\tu1TEl3Ub9yo9DNbaY2kPpp93nGuJw+XG4wcWXFggl4t0z6o9ueh3/MyX9X/G+jexDp\n\t5hP6CsKZzdcpg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653638268;\n\tbh=DOqx0Eq7VDz8sdZYlHs1mi+q4mUISIlWcAcxQwYkgpU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Z6dwBPH2lmOtBns8RKbbOcHdgVPjI4ApmEQDnWErLkEVjLB72yWpLDq/AzSIbA7CL\n\tcfp0NPuXyoATG3OZKwnv6zZMGWsV7Acnvvn7QzVnMBpoTaT59Ecx6udc5XfWN33mqN\n\tfP3d1YqZWdFDvCK3Zo4722EFSkRf9bpTV5G+QTME="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Z6dwBPH2\"; dkim-atps=neutral","Date":"Fri, 27 May 2022 10:57:43 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YpCEd1ofWqEtBK6i@pendragon.ideasonboard.com>","References":"<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>\n\t<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23188,"web_url":"https://patchwork.libcamera.org/comment/23188/","msgid":"<15dbe611-b0ff-9bfe-4600-1153117e0e49@ideasonboard.com>","date":"2022-05-27T10:08:33","subject":"Re: [libcamera-devel] [PATCH v2 14/19] py: Add README.md","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 27/05/2022 10:57, Laurent Pinchart wrote:\n> Hi Tomi,\n> \n> Thank you for the patch.\n> \n> On Tue, May 24, 2022 at 02:46:05PM +0300, Tomi Valkeinen wrote:\n>> Add a basic README for the Python bindings. While not a proper doc, the\n>> README and the examples should give enough guidance for users who are\n>> somewhat familiar with libcamera.\n>>\n>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n>> ---\n>>   src/py/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++\n> \n> Should this go to Documentation/python.md ?\n\nEverything there seems to be .rst, this is .md. Is that a problem?\n\nI thought Documentation/ is for the documentation that will be built \ninto a web page/pdf.\n\n  Tomi","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 366F2BD161\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 10:08:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 78C46633A5;\n\tFri, 27 May 2022 12:08:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DBCE633A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 12:08:37 +0200 (CEST)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 974D331A;\n\tFri, 27 May 2022 12:08:36 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653646119;\n\tbh=0HdRp2auQ/JTfFIoKMw2p55HO6cxoIkERNt158Bx3pQ=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=t2PMhK/+5YNm12R2vgHXQgw+UYhx15kG9RUwYH8NLkTEqeeZ/XkDTCYxxLkeI1yg5\n\tS8bRaepmJvI025o7dsG6d9fVMzoq3RIDYvcyraV+DukgRwuMQ2lpFRHckECRb+849T\n\teK3Fx3sTnRCqqG5rkStta2wPexNyBwyjzByzJMB17udLKEZCHr49nOmJNKHd3LcVKJ\n\tAqE99N/uYvElv1fPM0HJfq4lCNNLMkN88aliaJXS6qv9RcXlEx1oVUW9Of0Vcksy9S\n\tB2q4jKlzq7dsZhR7cvnrgwDmRkIHlzH4LMyuVfOxqk5J/mj5bXwyb+ihsEyvLWKIWg\n\tPEPgEJnhx2hDg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653646116;\n\tbh=0HdRp2auQ/JTfFIoKMw2p55HO6cxoIkERNt158Bx3pQ=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=tts6ioSt+XS3ER1FLAnKknmGhUKAxAAX3ZB90jjBGKJarnkYW6Ok4GC+PN7m+BKZN\n\tSqQVYFDQBexxiTyAtZsM/6L4XiQ3jSPxGbP6hCyv8qywHpEvb58dxd9e30C5Z97n2w\n\tPtUnWYFJqI1xtSyq3oYS3/a947WzwXOvGVYdh0+I="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tts6ioSt\"; dkim-atps=neutral","Message-ID":"<15dbe611-b0ff-9bfe-4600-1153117e0e49@ideasonboard.com>","Date":"Fri, 27 May 2022 13:08:33 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.9.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>\n\t<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>\n\t<YpCEd1ofWqEtBK6i@pendragon.ideasonboard.com>","In-Reply-To":"<YpCEd1ofWqEtBK6i@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23200,"web_url":"https://patchwork.libcamera.org/comment/23200/","msgid":"<YpEVwWF8Lw6IKOVX@pendragon.ideasonboard.com>","date":"2022-05-27T18:17:37","subject":"Re: [libcamera-devel] [PATCH v2 14/19] py: Add README.md","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nOn Fri, May 27, 2022 at 01:08:33PM +0300, Tomi Valkeinen wrote:\n> On 27/05/2022 10:57, Laurent Pinchart wrote:\n> > On Tue, May 24, 2022 at 02:46:05PM +0300, Tomi Valkeinen wrote:\n> >> Add a basic README for the Python bindings. While not a proper doc, the\n> >> README and the examples should give enough guidance for users who are\n> >> somewhat familiar with libcamera.\n> >>\n> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> >> ---\n> >>   src/py/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++\n> > \n> > Should this go to Documentation/python.md ?\n> \n> Everything there seems to be .rst, this is .md. Is that a problem?\n> \n> I thought Documentation/ is for the documentation that will be built \n> into a web page/pdf.\n\nThe Python bindings documentation isn't a second class citizen, we\nshould eventually publish it. .rst would indeed be better to match the\nrest of the documentation. Would it be a big burden to convert it ?","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 E6A2FBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 18:17:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 518ED633A7;\n\tFri, 27 May 2022 20:17:44 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E9ACB633A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 20:17:42 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [46.183.103.8])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 397B332A;\n\tFri, 27 May 2022 20:17:42 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653675464;\n\tbh=4jP+ohQJmeA7RyPv1DS2uWqQzlZhfIVY+vyLnnE+Ryw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=faua8sibJuIc5if4eCZwVYygQqbi+q9Qrydm+EYBIgDpyHQixSkWuf3VC110ydbkc\n\t8khc8vFsqobKJdPvO6mtHpzTBrLhSo+wKTXYbgQNJ/DOqMgoTJueyBh1e4lIKFqnLI\n\tro6VbLS5e6m/967BMuBxni9QLcOE6gbv/WN7MoE7BJXPvh2koIRDd75aNSz5K9dB2r\n\t1jtGFGd/Yv+S0gqWRZCF0F2NVBUe92pnsJSj/tuQ/b0D2+lqZiRpG+RHQQfjnGAfIy\n\tmKkFAytXSnpdNVVUExxBcouuNtQqqQHSzPcqAvCdyE+pOy4KlwjQwCH09yqall4ED3\n\tzzG1f4yfSiqwg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653675462;\n\tbh=4jP+ohQJmeA7RyPv1DS2uWqQzlZhfIVY+vyLnnE+Ryw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QXz2oNIyUPEEvdb9xLkn7SuhN1IOB4OLSnYJQLQGcl2NqkVaSoq/W2gm0rTtE2wKU\n\ts4MzyDfea1wb50DI62q0+QzppYa2Ooh0P/+nfobH4qjjmlSrnDZ+GPfY1VsXlGRAhX\n\tDtNsSjD6FYLlO6clEfHJ5hmxtLU+nfkiEroJIyRw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QXz2oNIy\"; dkim-atps=neutral","Date":"Fri, 27 May 2022 21:17:37 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YpEVwWF8Lw6IKOVX@pendragon.ideasonboard.com>","References":"<20220524114610.41848-1-tomi.valkeinen@ideasonboard.com>\n\t<20220524114610.41848-15-tomi.valkeinen@ideasonboard.com>\n\t<YpCEd1ofWqEtBK6i@pendragon.ideasonboard.com>\n\t<15dbe611-b0ff-9bfe-4600-1153117e0e49@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<15dbe611-b0ff-9bfe-4600-1153117e0e49@ideasonboard.com>","Subject":"Re: [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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]