From patchwork Mon Nov 30 13:38:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 3247 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.32520.1796045921155095503 for ; Mon, 30 Nov 2026 05:38:41 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=QW5Cknho; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8C8AB1575 for ; Mon, 30 Nov 2026 05:38:37 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0644A3F86F for ; Mon, 30 Nov 2026 05:38:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796045920; bh=LweW7L3yx9pc5JMMHgXwVgnT7kFJbhKSFielITuVGqo=; h=From:To:Subject:Date:From; b=QW5CknhoRaBMDVeEzS2VPdErrTP/MS1DtkOQEX0AaMRUC2MZ0GlAWO4T/ybPacgcf THuTl0csdgcaposKph04KH8Xox/8bJsABuA4qG5GBc1jfyivinqKGT1Su3Kkk2d+1e co1T5OC7k64Yzz69WczwBL8UCtgpF4Kgjseg8ksM= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [RFC PATCH 0/3] Auto-generated Python dependencies Date: Mon, 30 Nov 2026 13:38:30 +0000 Message-ID: <20261130133833.2868171-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 13:38:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251598 Hi, Attached is a rough RFC to add automatic Python dependencies to recipes, following the same model as the Go and Rust classes. It's slightly hacky still, but does mostly work: First, every recipe that uses the pypi class gets a PROVIDES for the normalised package name. The pydeps class then adds an update task that uses the pypa-build API to examine the build and runtime dependencies, and write an include file that sets DEPENDS and RDEPENDS. Finally there's a worked example with the python3-license-expression recipe. Plenty of caveats and things to think about: - The package variable name should probably be changed as it's not specific to PyPI. - Support for optional dependencies is needed, at least specifying the set of optional deps to enable. - Recipes that don't use pypi.bbclass don't get the provides, and not all recipes use that. Possibly it should done in a separate class that can be inherited in various places instead? Anything using pep517 or setuptools can be asked for it's package name at build time, so we could add this to the include file too maybe. - Alternatively, as this is writing a few lines instead of the hundreds that the rust/go tasks do, this could use the devtool APIs and update the recipe itself inline, instead of writing an include file? - It would be nice to have the include done by the class, but I can't see a variable for "THISDIR, but the directory of the recipe not the class". Anyway, it sort of works for for third party dependencies. My plan for the stdlib dependencies is still to remove the problem by continuing to shrink the number of packages. Cheers, Ross Ross Burton (3): pypi: add provides for the pypi package name classes: add pydeps class license-expression: use class meta/classes-recipe/pydeps.bbclass | 8 ++ meta/classes-recipe/pypi.bbclass | 5 ++ meta/files/py-update-requires.py | 81 +++++++++++++++++++ ...python3-license-expression-python-deps.inc | 8 ++ .../python3-license-expression_30.4.4.bb | 7 +- 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 meta/classes-recipe/pydeps.bbclass create mode 100755 meta/files/py-update-requires.py create mode 100644 meta/recipes-devtools/python/python3-license-expression-python-deps.inc