[{"id":26612,"web_url":"https://patchwork.libcamera.org/comment/26612/","msgid":"<825b6ab9-10b3-4b03-b9fa-1cae1026a832@ideasonboard.com>","date":"2023-03-09T15:47:36","subject":"Re: [libcamera-devel] [PATCH v4 00/15] py: New python bindings\n\tevent handling","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 09/03/2023 16:25, Tomi Valkeinen wrote:\n> Hi,\n> \n> I sent the v3 of the series (\"[PATCH v3 00/17] Python bindings event\n> handling\") more than half a year ago. I've addressed the review comments\n> which I think make sense and are more or less obvious. In fact, I\n> made those changes quite soon after receiving them, again over half a\n> year ago. I also added some additional patches on top (the unittest\n> improvements).\n> \n> But then I never had time to work on the biggest question, how to handle\n> the events, and so I never sent the v4. And then recently I added even\n> more patches on top. So I tought I'll just do a bit of work on the\n> series to introduce another way to manage the events, just as a hackish\n> RFC, and send the series. Perhaps there are more people interested in\n> the py bindings now, and we will get more discussion and ideas. I don't\n> want us to totally forget this series =).\n> \n> So, here it is. The \"py: New event handling\" patch adds the events as in\n> v3. But in the topmost patch, \"py: Hack for different event enable\n> mechanism\" I draft another way we might handle the enabling and\n> disabling of the events.\n> \n> One thing I didn't change was Laurent's comment that camera.stop()\n> should not return the disconnect events, only the request and buffer\n> completed events. I'm still not sure about that, but I think if we go\n> with the method I introduce in the topmost patch, it probably makes\n> sense to leave the disconnect events alone in camera.stop().\n> \n> And, for those not familiar with the series: This changes the Python API\n> in a breaking manner. Changes to scripts using the Python bindings are\n> needed (see the \"Use new events support\" patches):\n> \n> - Many methods throw exceptions now, instead of returning an error value\n\nA clarification here: The exception related changes to py scripts are \ndone in the \"py: Use exceptions instead of returning error codes\" patch.\n\n  Tomi\n\n> - The handling of events has changed. Previously it was all about\n>    request completed, and no other events. Now we support all the events.\n> \n>   Tomi\n> \n> Tomi Valkeinen (15):\n>    py: Use exceptions instead of returning error codes\n>    py: New event handling\n>    py: cam.py: Use new events support\n>    py: unittests.py: Use new events support\n>    py: simple-capture.py: Use new events support\n>    py: simple-continuous-capture.py: Use new events support\n>    py: simple-cam.py: Use new events support\n>    py: Drop get_ready_requests()\n>    py: Add hotplug-monitor.py\n>    py: unittests.py: Add weakref helpers and use del\n>    py: unittests.py: Add test for refs & keep-alives\n>    py: unittests.py: Fix type checker warnings\n>    py: Move Color Space and Transform classes to separate files\n>    py: Improve stub type generation for PyCameraEvent\n>    py: Hack for different event enable mechanism\n> \n>   src/py/cam/cam.py                            |  44 +--\n>   src/py/examples/hotplug-monitor.py           |  39 +++\n>   src/py/examples/simple-cam.py                |  34 +--\n>   src/py/examples/simple-capture.py            |  36 ++-\n>   src/py/examples/simple-continuous-capture.py |  38 +--\n>   src/py/libcamera/meson.build                 |   2 +\n>   src/py/libcamera/py_camera_manager.cpp       | 180 +++++++++--\n>   src/py/libcamera/py_camera_manager.h         |  68 ++++-\n>   src/py/libcamera/py_color_space.cpp          |  71 +++++\n>   src/py/libcamera/py_main.cpp                 | 303 +++++++++++--------\n>   src/py/libcamera/py_transform.cpp            |  81 +++++\n>   test/py/unittests.py                         | 280 ++++++++++++-----\n>   12 files changed, 853 insertions(+), 323 deletions(-)\n>   create mode 100644 src/py/examples/hotplug-monitor.py\n>   create mode 100644 src/py/libcamera/py_color_space.cpp\n>   create mode 100644 src/py/libcamera/py_transform.cpp\n>","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 AABE8BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Mar 2023 15:47:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EDA1E626CA;\n\tThu,  9 Mar 2023 16:47:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFFE961ED7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Mar 2023 16:47:39 +0100 (CET)","from [192.168.1.15] (91-154-32-225.elisa-laajakaista.fi\n\t[91.154.32.225])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 797B3589\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Mar 2023 16:47:39 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1678376862;\n\tbh=bBPoPYT2B/ECFFrokFgZ/x221hH5ZTByv/jdvo/4yMo=;\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:\n\tFrom;\n\tb=iwmWjEpvHHRBIWrX1WBTn5SOiOmxZNZOSAzocsILB+SD7+1qF+DxopDR5kpuQQIzz\n\tYrwbrZ4P9o5VYKoPQL4h2Ggm2uZv6MOKvPH9g72qxf1b7wc9UQZe7Ewgcc1uIjptUC\n\tLLHSmPJn6Lf7X6wOKeDo2N7vNQrKFVHT+2bW15PjtpcNPxPmVxp3AbautmWtPv6scl\n\tKuHcBeEZvWL1HM66KnuezOGeJ9jsoAu/bmIyVp+Po+423F8IQqvqpGXgNa4sTLDYUL\n\tugysVrlnxI9FMDwUC50P0tGgogjHQYvfaLzmYwcIi2wrkxZabv02d79zlggrxKv1kO\n\t0/w6CsVsPOb+A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1678376859;\n\tbh=bBPoPYT2B/ECFFrokFgZ/x221hH5ZTByv/jdvo/4yMo=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=vZ1R6udoGoLDyL2uOxfOyZFCBe58G1GKMRdp+A8raZFgStSTvVx7ur/u97Ein1PLz\n\t+hlFGzh4XSeP+KSOGrjdWo/oPzH4yDtBSMFB6RGugBbhUcD837iWmVnXsBNvpY9pKc\n\tvS91XhJIIOlPKCY2sgABbVdqQ+35pYKqoq5Egx7Q="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vZ1R6udo\"; dkim-atps=neutral","Message-ID":"<825b6ab9-10b3-4b03-b9fa-1cae1026a832@ideasonboard.com>","Date":"Thu, 9 Mar 2023 17:47:36 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.7.1","Content-Language":"en-US","To":"libcamera-devel@lists.libcamera.org","References":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","In-Reply-To":"<20230309142601.70556-1-tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 00/15] py: New python bindings\n\tevent handling","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>"}}]