For anyone who's interested, I recommend reading Julia Evan's article [2] about this problem and its solutions.
[0]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUN...
[1]: https://manpages.ubuntu.com/manpages/noble/man1/unbuffer.1.h...
[2]: https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-bufferin...
On MacOS, can install via homebrew's `expect`: https://apple.stackexchange.com/a/193152/330523
Apparently I knew about this 2.5 years ago as I commented on the accepted answer back then.
It's "Julia's article", not "The Julia article".
Update: it is was on here just a month ago actually: https://news.ycombinator.com/item?id=42275033
I don't know if Julia Evan even has an article.
Julia Evans's house, but the Evans' house.
(I consider myself a follower of Lynne Truss's, and have deliberately not considered a grammar reference for this answer, as I'm sure this is within the interested reader's ability and shan't spoil these readers' fun.)