Skip to content

Now With asyncio and Stuff!

Compare
Choose a tag to compare
@JnyJny JnyJny released this 25 Apr 22:11
· 680 commits to master since this release

Ok I'm sorry, but I'm not sorry. This version contains breaking changes. Lots of breaking changes. So many breaking changes. All of these changes were in service of converting the programming model from threads (to allow each light to be animated concurrently by a separate software thread), to asyncio.Tasks. Converting to tasks allowed each thread to be animated concurrently from a single thread. The driving reason is the explicitly single-threaded nature of hidapi which was beginning to exhibit more unstable behavior when used in a multi-threaded environment.

Version 0.17.0 is a near complete re-write of busylight.lights.USBLight:

  • improved subclass support
  • expanded utility of class methods for USBLight
  • removed threading support for animations and keep alive activities
  • added asyncio support for animations and keep alive activities
  • improved exception handling to detect unplugged/unavailable lights

The manager class busylight.manager.LightManager was re-written:

  • updated for USBLight class and subclasses
  • improved exception handling of lights
  • switched threading for asyncio to support concurrency

The command-line interface was updated to use the LightManager class with only minor changes to the actual interface.

The tests suite was updated for the new asyncio implementation. The mocking isn't quite as clean as I would like, but it's good enough for now. The tests should run whether or not there are physical lights connected.

Lastly, the FastAPI web interface underwent significant changes:

  • routes were removed
  • routes were expanded to accept optional keyword arguments

Note: changes between versions 0.16 and 0.17 were mostly python version compatibility fixes and GitHub Action maintenance. The real changes happened between 0.15 and 0.16.

Full Changelog: 0.15.0...0.17.0