Git Product home page Git Product logo

Comments (7)

jfhbrook avatar jfhbrook commented on June 29, 2024

I'm down to support the trio library. I thought trio's Futures were naively compatible with asyncio's - is that not the case?

If you want to sketch out what trio support would look like (aside from what exists now), I can help iterate on the ideas and give adding support for it a shot. Otherwise, if you want to take a crack at it and just PR what you want here you should be able to do something similar to the asyncio EE which subclasses the BaseEventEmitter and adds special handling around the result of a handler function.

from pyee.

jfhbrook avatar jfhbrook commented on June 29, 2024

I did some quick research, it looks like the necessary abstraction is called a nursery. Adding support for this looks relatively straightforward.

from pyee.

jfhbrook avatar jfhbrook commented on June 29, 2024

more research, unlikely to actually bang this out tonight but I can at least get my notes here

so the nursery is def the correct abstraction, though it should be noted that nurseries are async contextmanagers - so I could potentially make TrioEventEmitters also async contextmanagers. this would be loosely similar to how ExecutorEventEmitters optionally use sync contextmanagers. cool beans!

and here's how I can sense the event for the tests:

image

Between these, this sounds like a few hours of work. I can probably hack this up sometime over the weekend!

from pyee.

decentral1se avatar decentral1se commented on June 29, 2024

Thanks a lot! I'm trying to catch up on the discussion in the trio gitter and that was pretty helpful to understand why this is also perhaps not the correct approach to what I want to do. Since the asyncio streams people and trio streams people are collaborating closely, I am inclined to listen to their thoughts about structure ;) I am wondering perhaps now if I shouldn't just close this off and save you the work! Perhaps this is just a docs issue!?

from pyee.

jfhbrook avatar jfhbrook commented on June 29, 2024

it's true that an EventEmitter might not be the best solution to your problem, though I can't really tell you that either way. I would need a lot more information about your use case, and probably greater familiarity with trio, to say anything intelligent here.

all that said, please keep this issue open. I actually thought trio's interop with asyncio was a lot tighter (meaning this exposed a use case I wasn't aware of) and I'm totally down to implement even if it's "non-idiomatic". like I said in the gitter, I don't really care about dogma and I don't have a horse in this race.

from pyee.

decentral1se avatar decentral1se commented on June 29, 2024

I'm not into the dogma either but there is some stream gathering around this idea of structured concurrency now and I want to find the surest path for my work that won't have me re-writing all the things.

OK, let's keep this open 👍

from pyee.

jfhbrook avatar jfhbrook commented on June 29, 2024

#62

from pyee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.