Skip to main content

anyio implementation of an asynchronous Executor.

Project description

Anyio-Executor

Inspired by the newer aiolibs-executor library this library provides a asynchronous executor for anyio and has compatability with 3.10 and newer versions of python.

Installation

pip install anyio-executor

Usage

It borrows a simillar interface to that of aiothreading however this library is a lot more simplistic as an external thread is not being launched. As for queues, anyio doesn't support having it's own queue objects so in order to meet demands for excellent performance aiologic is utilized for that role.

import anyio

from anyio_executor import Executor


async def fn(i: int):
    await anyio.sleep(i)
    print(f"{i} done!")
    return i

async def main():
    async with Executor(10) as e:
        items = await e.map(fn, [1, 2, 1, 2, 3])
    print(items)

    async with Executor(10) as e:
        # it will also take async for iterations.
        async for i in e.map(fn, [1, 2, 1, 2, 3]):
            print(i)

if __name__ == "__main__":
    anyio.run(main)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anyio_executor-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anyio_executor-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file anyio_executor-0.1.1.tar.gz.

File metadata

  • Download URL: anyio_executor-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for anyio_executor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4d5a689e17bb2669d1a9981e6f0e16e5384ccbc675cc0054fce4f785c84faf2
MD5 0376bc9c22c0f40d5436c6aec9b1e95c
BLAKE2b-256 2647fa81843d318c08b7a6769d20905e1a9fd358acda5aaa10ba4ce4028bdf2b

See more details on using hashes here.

File details

Details for the file anyio_executor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: anyio_executor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for anyio_executor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f54b9260f8a99b58556a8c21544c58b2880d7e63b913761cbeb991b112894e3
MD5 e2163b17483ece454b829b58179083f3
BLAKE2b-256 5c1402c75da6e7c04343824f0b2e404d624c52aa3f699b63e12d2f7a1b88bdd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page