-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single, async-first code base #624
Comments
Thanks for raising this David. I totatlly agree with the sentiment of this and proposed similar in the Kernel Provisioning proposal:
In my very brief look at the Also, when we talk about deprecation and general evolution within the Jupyter ecosystem, the config system always seems to come into play, and by subclassing the sync classes with async versions, the async classes have been able to leverage the same configuration. As a result, I think we'd probably want to retain the class hierarchy for that purpose, yet essentially make the sync classes functionally abstract. (Not sure how formally that can be done without impacting traitlets.) Another approach would be to bite the bullet and:
Although this introduces a bit more support burden now, it leaves existing behaviors and custom subclasses functionally equivalent and is definitive (no magic happening or third-party behavior dependency). Of course, I'm sure there are other ways to address this and I'm in favor of anything that gets us (ultimately) down to a single implementation. I just want to be sure we consider configuration and (to a lesser extent) custom subclasses as those directly impact our downstream clients. |
Actually my proposal is not to get rid of the non-async classes, but to automatically generate them from the async classes. If configuration lives in e.g. |
Ok - thanks for the response. The goal for the configuration piece is that existing configuration file entries (e.g.,
Again, I'm skeptical and I think we'll find that this restricts innovation by introducing a least-common-denominator approach. For example, I think it's unacceptable to ask kernel provisioner authors to have two implementations - just so the the sync version of kernel manager (whose clients are fewer each day) can use provisioning. I just feel split/deprecate is the safer approach moving forward and gets us to a place of literally having one set of classes to support. But that's only my opinion. |
Actually I found one strong reason to not go the |
Thanks for the reference David. I just came back to add that I don't want to prohibit any kind of prototyping to occur since "touching" this kind of stuff is usually the best way to really see if it might help and better understand where the deficiencies might lie. I've just found that with this kind of tooling it's usually tough to address every need. Another scenario I was curious about was - when some methods on the "sync" class are already async, Is there a mechanism for retaining the Thanks again for starting this discussion - it's definitely worthwhile. |
I think one hiccup for compatibility when using That's an implementation detail, though. I fully support the general approach. |
I guess it depends what we call "sync" or "async", in this case if the class has some async methods, is it still a sync class? You'll need an event loop to run this method, so this class is incompatible with a pure sync runtime, e.g. it couldn't run on python2. |
In #623 (comment) we talked about using unasync to support sync/async in jupyter-client. The way it works is by having a single "source of truth", the async code, and automatically generate the sync code from it.
This would allow us to get rid of (manually) duplicated code, and it might be a better option than wrapping async code and run it until complete to get a blocking version, as we did in nbclient.
Any thought?
The text was updated successfully, but these errors were encountered: