I hereby claim:
- I am mikenerone on github.
- I am mikenerone (https://keybase.io/mikenerone) on keybase.
- I have a public key ASArmgpmwQH7Nd-viNLydw6S6qYFXoju2d24Puu7R-R6Iwo
To claim this, I am signing this object:
| """ | |
| Example of running an embedded IPython shell inside an already-running trio loop with working autoawait (it's handy | |
| to be able to start an interactive REPL with your application environment fully initialized). This is a full solution | |
| that works around https://github.com/ipython/ipython/issues/680 (see | |
| https://gist.github.com/mikenerone/3640fdd450b4ca55ee8df4d4da5a7165 for how simple it *could* be). This bug should be | |
| fixed IMO (using atexit is a questionable design choice in the first place given the embedding feature of IPython | |
| IMO). As it is now, the entire IPythonAtExitContext context manager exists only to work around the problem, | |
| otherwise it would result in an error on process exit when IPython's atexit-registered method calls fail to save the | |
| input history. |
| """ | |
| Example of running an embedded IPython shell inside an already-running trio loop with working autoawait (it's handy | |
| to be able to start an interactive REPL with your application environment fully initialized). This works as is, | |
| and it really should be this easy. Unfortunately, due to https://github.com/ipython/ipython/issues/680, | |
| this currently results in an error on process exit when IPython's atexit-registered method calls fail to save the | |
| input history. This bug should be fixed IMO (using atexit is a questionable design choice in the first place given | |
| the embedding feature of IPython IMO). Sadly, working around it is significantly less trivial. See | |
| https://gist.github.com/mikenerone/786ce75cf8d906ae4ad1e0b57933c23f for an example of that full solution. | |
| """ |
I hereby claim:
To claim this, I am signing this object:
| #! /usr/bin/env python | |
| from twisted.internet import reactor | |
| from twisted.internet.task import LoopingCall | |
| class LoopingCountdown(LoopingCall): | |
| _instances = set([]) | |
| def __init__(self, counter): | |
| LoopingCountdown._instances.add(self) |