Skip to content

Remove BackgroundSocket wrapper, use IOPubThread directly#1505

Open
erikgaas wants to merge 2 commits intoipython:mainfrom
erikgaas:remove-background-socket
Open

Remove BackgroundSocket wrapper, use IOPubThread directly#1505
erikgaas wants to merge 2 commits intoipython:mainfrom
erikgaas:remove-background-socket

Conversation

@erikgaas
Copy link

@erikgaas erikgaas commented Mar 6, 2026

Summary

BackgroundSocket was a thin wrapper around IOPubThread that provided send/send_multipart methods and deprecated zmq socket attribute proxying (deprecated since ipykernel 4.3.0 in 2016 — 10 years ago).

Since IOPubThread already has send_multipart, the wrapper is unnecessary. This PR moves the send() convenience method to IOPubThread and removes BackgroundSocket entirely.

Changes

  • Add send() method to IOPubThread
  • Remove BackgroundSocket class from iostream.py
  • Remove background_socket attribute from IOPubThread
  • Update kernelapp.py to assign iopub_thread directly as iopub_socket
  • Update inprocess/ipkernel.py to use IOPubThread type
  • Simplify test to test IOPubThread.send directly

4 files changed, 11 insertions, 70 deletions.

BackgroundSocket was a thin wrapper around IOPubThread that provided
send/send_multipart and deprecated zmq socket attribute proxying (since
ipykernel 4.3.0, 2016). Move send() to IOPubThread and remove the wrapper.

- Add send() method to IOPubThread
- Remove BackgroundSocket class from iostream.py
- Update kernelapp.py to use iopub_thread directly
- Update inprocess/ipkernel.py to use IOPubThread type
- Simplify test to test IOPubThread.send directly
@erikgaas
Copy link
Author

erikgaas commented Mar 6, 2026

tbh im not totally clear on how testing is working on this since many fail. could use some pointers on this

@erikgaas erikgaas closed this Mar 6, 2026
@erikgaas erikgaas reopened this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant