Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Lightweight asyncio-like library for MicroPython, built around native Python coroutines.

Project Description

uasyncio is MicroPython’s asynchronous sheduling library, roughly modeled after CPython’s asyncio.

uasyncio doesn’t use naive always-iterating scheduling algorithm, but performs a real time-based scheduling, which allows it (and thus the whole system) to sleep when there is nothing to do (actual implementation of that depends on I/O scheduling algorithm which actually performs the wait operation).

Major conceptual differences to asyncio:

  • Avoids defining a notion of Future, and especially wrapping coroutines in Futures, like CPython asyncio does. uasyncio works directly with coroutines (and callbacks).
  • Methods provided are more consistently coroutines.
  • uasyncio uses wrap-around millisecond timebase (as native to all MicroPython ports.)
  • Instead of single large package, number of subpackages are provided (each installable separately).

Specific differences:

  • For millisecond scheduling, loop.call_later_ms() and uasyncio.sleep_ms() are provided.
  • As there’s no monotonic time, loop.call_at() is not provided. Instead, there’s loop.call_at_() which is considered an internal function and has slightly different signature.
  • call_* funcions don’t return Handle and callbacks scheduled by them aren’t cancellable. If they need to be cancellable, they should accept an object as an argument, and a “cancel” flag should be set in the object, for a callback to test.
  • Future object is not available.
  • ensure_future() and Task() perform just scheduling operations and return a native coroutine, not Future/Task objects.
  • Some other functions are not (yet) implemented.
  • StreamWriter method(s) are coroutines. While in CPython asyncio, StreamWriter.write() is a normal function (which potentially buffers unlimited amount of data), uasyncio offers coroutine StreamWriter.awrite() instead. Also, both StreamReader and StreamWriter have .aclose() coroutine method.
Release History

Release History

This version
History Node

1.4

History Node

1.3

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2

History Node

1.1.2

History Node

1.0.1

History Node

0.9.1

History Node

0.8.1

History Node

0.7.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
micropython-uasyncio-1.4.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Dec 15, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting