groove-x / trio-util

Utility library for the Python Trio async/await framework
https://trio-util.readthedocs.io/
MIT License
68 stars 6 forks source link

Add a LineReader? #22

Open gmacon opened 11 months ago

gmacon commented 11 months ago

I'm interested in adding the LineReader that @njsmith posted on StackOverflow to trio-util. I've used in on a couple internal projects. I'm not sure it's 100% baked in its current form (for example, there are no tests right now), but I'd be willing to put in some work improving it if it would be accepted here

belm0 commented 11 months ago

The follow-up discussion (https://github.com/python-trio/trio/issues/796) looks daunting, I haven't read through it. At a glance, I gather what was posted on stack overflow had some holes and people made various enhancements.

That trio issue may be a good venue to see if anyone would like to collaborate with you and get something into trio proper.

gmacon commented 11 months ago

That's a long discussion...

I'm not sure I have a clear takeaway, though. It feels like Trio will eventually get a well-designed and flexible API merged in, but I'm personally more interested in a good-enough solution being available today. The code njs posted to SO solves exactly one problem, and it happens to solve the problem I have, but it isn't as flexible as what's being discussed in the follow-up.

Would y'all be willing to accept the current implementation plus tests knowing that it's limited and only solves one problem to fill this gap until the complete solution is available natively in Trio?

belm0 commented 11 months ago

Seems reasonable. Be forewarned that trio-util may have some bit rot to navigate, and we strictly need to maintain support for older trio and python versions.