question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Concurrency backends vs AnyIO

See original GitHub issue

Follow-up for @sethmlarson’s comment here: https://github.com/encode/httpx/pull/276#issuecomment-526350945

Just wondering since I just found the project, would anyio work for us?

For context: we have an internal ConcurrencyBackend interface whose job is to provide async-related operations that aren’t tied to a particular implementation, e.g. asyncio or trio.

AnyIO (docs, code, cc @agronholm) is an existing project that takes the exact similar approach to provide an async API that somewhat resembles that of trio.

Sample code taken from here:

import anyio


async def sometask(num):
    print('Task', num, 'running')
    await anyio.sleep(1)
    print('Task', num, 'finished')


async def main():
    async with anyio.create_task_group() as group:
        for num in range(5):
            await group.spawn(sometask, num)

    print('All tasks finished!')


anyio.run(main)

I think @sethmlarson’s question was really: should we consider replacing our ConcurrencyBackend API with AnyIO?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tomchristiecommented, Sep 4, 2019

Counter-intuitively, the low-impact way of exploring this would be to implement an alternate concurrency backend, that uses AnyIO.

1reaction
tomchristiecommented, Sep 3, 2019

From a glance over the docs it looks like it’s got everything we’d need, yup. (But that’s about as much depth as I’d gone into)

Read more comments on GitHub >

github_iconTop Results From Across the Web

AnyIO — AnyIO 3.6.2 documentation
AnyIO is an asynchronous networking and concurrency library that works on top of either ... It will blend in with native libraries of...
Read more >
Anyio: all you need for async programming stuff
Anyio helps you write correct and beautiful concurrent programs in python using the ... By default anyio runs with the asyncio backend.
Read more >
Structured concurrency in Python with AnyIO - Matt Westcott
This post is about AnyIO, a Python library providing structured concurrency primitives on top of asyncio. This is important because your project ...
Read more >
AnyIO, a Python library providing structured concurrency ...
AnyIO is a asynchronous compatibility API that allows applications and libraries ... with native libraries from your selected backend in applications.
Read more >
Anyio: High Level Asynchronous Concurrency and ... - Morioh
AnyIO is an asynchronous networking and concurrency library that works on top of either ... It will blend in with native libraries of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found