Skip to main content

Compatibility layer for CPython/anyio and MicroPython/uasyncio

Project description

moat-lib-micro

% start main % start synopsis

Compatibility wrappers for async code that runs run on both CPython/anyio and MicroPython/asyncio.

% end synopsis

This module provides a unified interface for asynchronous programming that works across both CPython (using anyio) and MicroPython (using asyncio). It includes wrappers for logging and timing, common async primitives like Event, Lock, Queue, or TaskGroup, async context managers, and more.

Usage

The module provides consistent imports that work on both platforms:

from moat.lib.micro import Event, Lock, Queue, TaskGroup, sleep

# Use these primitives the same way on both CPython and MicroPython

async def worker(evt):
    await evt.wait()

async def example():
    event = Event()
    async with TaskGroup() as tg:
        tg.start_soon(worker, event)
        await sleep(1)
        event.set()

% end main

License

Licensed under the MIT License.

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

moat_lib_micro-0.3.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

moat_lib_micro-0.3.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file moat_lib_micro-0.3.1.tar.gz.

File metadata

  • Download URL: moat_lib_micro-0.3.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moat_lib_micro-0.3.1.tar.gz
Algorithm Hash digest
SHA256 25e942052e1142c010aa2a099fe21a4b21145a4248162227796fe2c9ac9e3b44
MD5 e9f7af69a2c3df038d26fad939f1abf8
BLAKE2b-256 67b9c9c3c6898852d800a8134a50d0174c77772405521f4ddc2c74cff586e015

See more details on using hashes here.

File details

Details for the file moat_lib_micro-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: moat_lib_micro-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for moat_lib_micro-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06023e616978df63498dcdb0a26f541dd5dcb713cab16d84ed2b00f1a0a366f8
MD5 b6db04647ea0ae3328f0654f437b0a75
BLAKE2b-256 edeb569cbb3a4c07b635d9d7e408275ebf16cb45968a0a108097f5e9ebcad7ef

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