{"library":"mode","title":"Mode","description":"Mode is an async service-based programming library built on top of asyncio. It provides Service, Worker, and BackgroundThreadService classes for composing asynchronous services. Current version is 4.4.0, requires Python ~=3.6. Release cadence is irregular.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install mode"],"cli":null},"imports":["from mode import Service","from mode import Worker","from mode import BackgroundThreadService"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import asyncio\nfrom mode import Service\n\nclass MyService(Service):\n    async def run(self) -> None:\n        while not self.should_stop:\n            await asyncio.sleep(1)\n            print('Service running')\n\nasync def main():\n    service = MyService()\n    await service.start()\n    await asyncio.sleep(5)\n    await service.stop()\n\nif __name__ == '__main__':\n    asyncio.run(main())","lang":"python","description":"Simple example of creating and running a Mode Service.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}