On Sat, Aug 18, 2018 at 2:44 PM, Chris Jerdonek
wrote:
> The kind of alternative I had in mind for a neutral location is
> setting an attribute with an agreed upon name on a module in the
> standard lib, perhaps something like
> `contextvars.current_async_library_cvar` to use your naming. This is
On Sat, Aug 18, 2018 at 2:13 PM, Nathaniel Smith wrote:
> On Sat, Aug 18, 2018, 01:22 Chris Jerdonek wrote:
>>
>> Also, just to be clear, I think the idea of a library to sniff this
>> information is great.
>>
>> It's just the location of where this information is being stored that
>> I'm
On Fri, Aug 17, 2018 at 11:44 PM, Chris Jerdonek
wrote:
> On Fri, Aug 17, 2018 at 12:50 PM, Nathaniel Smith wrote:
>> On Fri, Aug 17, 2018, 12:12 Chris Jerdonek wrote:
>>>
>>> Did you also think about whether it would be possible for a library to
>>> advertise itself without having to depend on
On Fri, Aug 17, 2018 at 12:50 PM, Nathaniel Smith wrote:
> On Fri, Aug 17, 2018, 12:12 Chris Jerdonek wrote:
>>
>> Did you also think about whether it would be possible for a library to
>> advertise itself without having to depend on a third-party library
>> (e.g. using some sort of convention)?
On Fri, Aug 17, 2018, 09:09 Alex Grönholm wrote:
> This was my approach:
>
> def _detect_running_asynclib() -> str:
> if 'trio' in sys.modules:
> from trio.hazmat import current_trio_token
> try:
> current_trio_token()
> except RuntimeError:
>
If I'm reading the docs correctly, it looks like an async library has
to depend on sniffio in order to be detected by sniffio:
https://sniffio.readthedocs.io/en/latest/#adding-support-to-a-new-async-library
Did you also think about whether it would be possible for a library to
advertise itself
If you look at the code more carefully, you'll see that I'm not merely
checking what's been imported. In each case I'm asking the relevant
framework if they're running an event loop *in the current thread*.
pe, 2018-08-17 kello 09:26 -0700, Brett Cannon kirjoitti:
> Importation does not equate to
Importation does not equate to execution. I.e. since I could have multiple
event loops running at once that means what's in sys.modules can't tell me
what event loop I'm currently interacting with.
On Fri, 17 Aug 2018 at 09:09 Alex Grönholm wrote:
> This was my approach:
>
> def
This was my approach:
def _detect_running_asynclib() -> str:
if 'trio' in sys.modules:
from trio.hazmat import current_trio_token
try:
current_trio_token()
except RuntimeError:
pass
else:
return 'trio'
if 'curio' in
Neat!
On Thu, Aug 16, 2018 at 9:02 AM Nathaniel Smith wrote:
> Hi all,
>
> A number of people are working on packages that support multiple async
> backends (e.g., asyncio + trio, or trio + curio, or trio + twisted,
> ...). So then the question arises... how can I figure out which async
>
Hi all,
A number of people are working on packages that support multiple async
backends (e.g., asyncio + trio, or trio + curio, or trio + twisted,
...). So then the question arises... how can I figure out which async
library my user is actually using?
Answer: install sniffio, and then call
11 matches
Mail list logo