diff mbox series

packaging-pypi: make bitbake-setup depend on websockets

Message ID 20261009133418.215223-1-ross.burton@arm.com
State New
Headers show
Series packaging-pypi: make bitbake-setup depend on websockets | expand

Commit Message

Ross Burton Oct. 9, 2026, 1:34 p.m. UTC
If you're installing bitbake-setup via a venv and pip, you'll usually
have a self-containted venv that doesn't have access to the system-wide
site-packages tree.  This means that even if you have websockets
installed on the host, the venv with bitbake-setup in will not, and if
the same venv is used to run bitbake it won't be able to connect to
the hashserver.

Solve this by adding a dependency on websockets to the bitbake-setup
wheel.  This isn't strictly true as bitbake-setup itself doesn't use the
hashserver, but reusing the venv is common and this solves a common pain
point when setting up a new build environment.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 packaging-pypi/bitbake-setup/pyproject.toml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Rob Woolley Oct. 9, 2026, 7:29 p.m. UTC | #1
Hi Ross,

I think this would add the websocket module to the bitbake-setup package,
even though it doesn't deliver the bitbake code that uses websocket.

I looked at the bitbake code, and it seems to already cover this failure
case in a commit from Alexander:
https://git.openembedded.org/bitbake/commit/?id=2d15e6fc93f6a73c9c84e399613f931f1c783922

It looks like it should output the following message to the user in this
situation:

Unable to use hash equivalence server at 'websocket' due to missing or
incorrect python module:
websocket
Please install the needed module on the build host, or use an environment
containing it:
 - if you are using bitbake-setup, run 'bitbake-setup install-buildtools'
 - openembedded-core layer contains 'scripts/install-buildtools' that can
also be used
 - or set up pip venv
You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result
in significantly longer build times as bitbake will be unable to reuse
prebuilt sstate artefacts.


Is there a use case where the user won't see the message?

Cheers,
Rob

On Fri, Oct 9, 2026 at 9:34 AM Ross Burton via lists.openembedded.org
<ross.burton=arm.com@lists.openembedded.org> wrote:

> If you're installing bitbake-setup via a venv and pip, you'll usually
> have a self-containted venv that doesn't have access to the system-wide
> site-packages tree.  This means that even if you have websockets
> installed on the host, the venv with bitbake-setup in will not, and if
> the same venv is used to run bitbake it won't be able to connect to
> the hashserver.
>
> Solve this by adding a dependency on websockets to the bitbake-setup
> wheel.  This isn't strictly true as bitbake-setup itself doesn't use the
> hashserver, but reusing the venv is common and this solves a common pain
> point when setting up a new build environment.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  packaging-pypi/bitbake-setup/pyproject.toml | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/packaging-pypi/bitbake-setup/pyproject.toml
> b/packaging-pypi/bitbake-setup/pyproject.toml
> index 90ed1ffb98..0cd2d37803 100644
> --- a/packaging-pypi/bitbake-setup/pyproject.toml
> +++ b/packaging-pypi/bitbake-setup/pyproject.toml
> @@ -20,7 +20,9 @@ classifiers = [
>  ]
>
>  dependencies = [
> -  # bitbake-setup is mostly self-contained
> +  # bitbake-setup is mostly self-contained, but hashserver needs
> websockets
> +  "websockets >= 9.0; python_version == '3.9'",
> +  "websockets >= 10.0; python_version >= '3.10'"
>  ]
>
>  [project.optional-dependencies]
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#20310):
> https://lists.openembedded.org/g/bitbake-devel/message/20310
> Mute This Topic: https://lists.openembedded.org/mt/121671625/556952
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> rob.woolleywr@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alexander Kanavin Oct. 10, 2026, 9:30 a.m. UTC | #2
On Fri, 9 Oct 2026 at 21:29, Rob Woolley via lists.openembedded.org
<rob.woolleywr=gmail.com@lists.openembedded.org> wrote:

>
> I think this would add the websocket module to the bitbake-setup package,
> even though it doesn't deliver the bitbake code that uses websocket.
>
> I looked at the bitbake code, and it seems to already cover this failure
> case in a commit from Alexander:
> https://git.openembedded.org/bitbake/commit/?id=2d15e6fc93f6a73c9c84e399613f931f1c783922
>
> It looks like it should output the following message to the user in this
> situation:
>
> Unable to use hash equivalence server at 'websocket' due to missing or
> incorrect python module:
> websocket
> Please install the needed module on the build host, or use an environment
> containing it:
>  - if you are using bitbake-setup, run 'bitbake-setup install-buildtools'
>  - openembedded-core layer contains 'scripts/install-buildtools' that can
> also be used
>  - or set up pip venv
> You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result
> in significantly longer build times as bitbake will be unable to reuse
> prebuilt sstate artefacts.
>
>
> Is there a use case where the user won't see the message?
>

I think the intent (which I fully support) is that when a user runs 'pip
install bitbake-setup', that would install both bitbake-setup and
websockets. So they never even see this message or have to figure out what
to do about it. Ross's fix is right, if it adjusts the dependencies of
bitbake-setup package to include websockets.

I've just done a demo at bitbake-setup at ELC/OSS and there was a slightly
awkward but mercifully brief moment where the message popped up when I
tried to run bitbake, and I had to 'pip install websockets' and rerun
bitbake. Let's eliminate this.


Alex
Ross Burton Oct. 10, 2026, 10:36 a.m. UTC | #3
Yes, the demo was exactly what caused this patch. That's a common use case, and a bit of friction we can make disappear.

Ross
diff mbox series

Patch

diff --git a/packaging-pypi/bitbake-setup/pyproject.toml b/packaging-pypi/bitbake-setup/pyproject.toml
index 90ed1ffb98..0cd2d37803 100644
--- a/packaging-pypi/bitbake-setup/pyproject.toml
+++ b/packaging-pypi/bitbake-setup/pyproject.toml
@@ -20,7 +20,9 @@  classifiers = [
 ]
 
 dependencies = [
-  # bitbake-setup is mostly self-contained
+  # bitbake-setup is mostly self-contained, but hashserver needs websockets
+  "websockets >= 9.0; python_version == '3.9'",
+  "websockets >= 10.0; python_version >= '3.10'"
 ]
 
 [project.optional-dependencies]