Comments (7)
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.
I did some quick research, it looks like the necessary abstraction is called a nursery. Adding support for this looks relatively straightforward.
from pyee.
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:
Between these, this sounds like a few hours of work. I can probably hack this up sometime over the weekend!
from pyee.
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.
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.
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.
from pyee.
Related Issues (20)
- type-safe TypedEventEmitter implementation HOT 1
- Wrap captured exceptions in a PyeeError HOT 3
- [Regression]: EventEmitter.listeners("foo") throws if no listener exists HOT 2
- Regression: Docs on RTD are Broken HOT 1
- Automate RTD Build HOT 1
- Adopt pyproject.toml HOT 1
- Add .readthedocs.yaml HOT 1
- The 9.0.4 release in pypi isn't tagged in git HOT 2
- 9.0.4: pytest warnings HOT 5
- 9.0.4: sphinx warnings `reference target not found` HOT 6
- async lock error HOT 1
- AsyncIOEventEmitter should keep a reference to scheduled futures HOT 5
- "port of Node.js EventEmitter" not entirely accurate
- refactor EE import paths
- Handle for the async functions? HOT 4
- Using in Multiple Scripts HOT 1
- OSX Issue module 'select' has no attribute 'epoll' HOT 1
- Recommend error handling HOT 5
- Emit can be error HOT 1
- pyee release 9.0.x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyee.