Skip to contentSkip to conversation

packaging-pypi: make bitbake-setup depend on websockets

PATCH In review Ross Burton 3 participants 4 messages Oct 9 – Oct 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 packaging-pypi: make bitbake-setup depend on websockets

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.

---
 packaging-pypi/bitbake-setup/pyproject.toml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
packaging-pypi/bitbake-setup/pyproject.toml +3 -1
index 90ed1ffb98..0cd2d37803 100644
@@ -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]
Signature · 1 line
2.43.0
#1 lore raw

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

Quoted 49 lines · Ross Burton via lists.openembedded.org

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.

---
 packaging-pypi/bitbake-setup/pyproject.toml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
packaging-pypi/bitbake-setup/pyproject.toml +1 -1
index 90ed1ffb98..0cd2d37803 100644
@@ -20,7 +20,9 @@ classifiers = [
 ]
 
 dependencies = [
-  # bitbake-setup is mostly self-contained
+  # bitbake-setup is mostly self-contained, but hashserver needs

websockets

packaging-pypi/bitbake-setup/pyproject.toml +2 -1
+  "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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 25 lines · Rob Woolley via lists.openembedded.org

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.

Quoted 2 lines

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

#3 lore raw

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

________________________________
From: Alexander Kanavin <[email protected]>
Sent: Saturday, 10 October 2026 11:30:36
To: [email protected] <[email protected]>
Cc: Ross Burton <[email protected]>; [email protected] <[email protected]>
Subject: Re: [bitbake-devel] [PATCH] packaging-pypi: make bitbake-setup depend on websockets

On Fri, 9 Oct 2026 at 21:29, Rob Woolley via lists.openembedded.org<http://lists.openembedded.org> <[email protected]<mailto:[email protected]>> 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