aiomisc 18.0.19


pip install aiomisc

  Latest version

Released: Mar 23, 2026


Meta
Author: Dmitry Orlov
Requires Python: >=3.11

Classifiers

Development Status
  • 5 - Production/Stable

Framework
  • AsyncIO
  • Pytest
  • aiohttp

Intended Audience
  • Developers
  • Education
  • Information Technology
  • System Administrators

Natural Language
  • English
  • Russian

Operating System
  • MacOS
  • Microsoft :: Windows
  • POSIX :: Linux
  • POSIX

Programming Language
  • Python :: 3
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: Implementation :: CPython
  • Python

Topic
  • Internet :: WWW/HTTP
  • Internet
  • Software Development :: Libraries :: Python Modules
  • Software Development :: Libraries
  • Software Development
  • System :: Archiving :: Compression
  • System :: Logging
  • System
  • Utilities

Typing
  • Typed
Coveralls Actions Latest Version https://img.shields.io/pypi/wheel/aiomisc.svg https://img.shields.io/pypi/pyversions/aiomisc.svg https://img.shields.io/pypi/l/aiomisc.svg

Miscellaneous utils for asyncio.

As a programmer, you are no stranger to the challenges that come with building and maintaining software applications. One area that can be particularly difficult is designing the architecture of software that uses asynchronous I/O.

This is where aiomisc comes in. aiomisc is a Python library that provides a collection of utility functions and classes for working with asynchronous I/O in a more intuitive and efficient way. It is built on top of the asyncio library and is designed to make it easier for developers to write asynchronous code that is both reliable and scalable.

With aiomisc, you can take advantage of powerful features like worker pools, connection pools, circuit breaker pattern, and retry mechanisms such as asyncbackoff and asyncretry to make your asyncio code more robust and easier to maintain. In this documentation, we’ll take a closer look at what aiomisc has to offer and how it can help you streamline your asyncio service development.

Why use aiomisc?

Problem: Production asyncio applications require significant boilerplate for logging, graceful shutdown, thread pools, and error handling.

Solution: aiomisc handles infrastructure so you can focus on business logic.

Plain asyncio

With aiomisc

Manual signal handling

Built into entrypoint

Manual logging setup

Single parameter

Manual thread pool

Automatic + @threaded

Try/finally cleanup

Service stop() method

Installation

Installation is possible in standard ways, such as PyPI or installation from a git repository directly.

Installing from PyPI:

pip3 install aiomisc

Installing from github.com:

# Using git tool
pip3 install git+https://github.com/aiokitchen/aiomisc.git

# Alternative way using http
pip3 install \
    https://github.com/aiokitchen/aiomisc/archive/refs/heads/master.zip

The package contains several extras and you can install additional dependencies if you specify them in this way.

With uvloop:

pip3 install "aiomisc[uvloop]"

With aiohttp:

pip3 install "aiomisc[aiohttp]"

Complete table of extras below:

example

description

pip install aiomisc[aiohttp]

For running aiohttp applications.

pip install aiomisc[asgi]

For running ASGI applications

pip install aiomisc[carbon]

Sending metrics to carbon (part of graphite)

pip install aiomisc[cron]

use croniter for scheduling tasks

pip install aiomisc[raven]

Sending exceptions to sentry using raven

pip install aiomisc[rich]

Use rich for logging

pip install aiomisc[uvicorn]

For running ASGI application using uvicorn

pip install aiomisc[uvloop]

use uvloop as a default event loop

You can combine extras values by separating them with commas, for example:

pip3 install "aiomisc[aiohttp,cron,rich,uvloop]"

Quick Start

This section will cover how this library creates and uses the event loop and creates services. Of course, you can’t write about everything here, but you can read about a lot in the Tutorial section, and you can always refer to the Modules and API reference sections for help.

Event-loop and entrypoint

Let’s look at this simple example first:

import asyncio
import logging

import aiomisc

log = logging.getLogger(__name__)

async def main():
    log.info('Starting')
    await asyncio.sleep(3)
    log.info('Exiting')


if __name__ == '__main__':
    with aiomisc.entrypoint(log_level="info", log_format="color") as loop:
        loop.run_until_complete(main())

This code declares an asynchronous main() function that exits after 3 seconds. It would seem nothing interesting, but the whole point is in the entrypoint.

What does the entrypoint do, it would seem not so much, it creates an event-loop and transfers control to the user. However, under the hood, the logger is configured in a separate thread, a pool of threads is created, services are started, but more on that later and there are no services in this example.

Alternatively, you can use the standard asyncio.Runner:

import asyncio

async def main():
    await asyncio.sleep(1)

if __name__ == '__main__':
    with asyncio.Runner() as runner:
        runner.run(main())

Services

The main thing that an entrypoint does is start and gracefully stop services.

The service concept within this library means a class derived from the aiosmic.Service class and implementing the async def start(self) -> None: method and optionally the async def stop(self, exc: Optional[ Exception]) -> None method.

The concept of stopping a service is not necessarily is pressing Ctrl+C keys by user, it’s actually just exiting the entrypoint context manager.

The example below shows what your service might look like:

from aiomisc import entrypoint, Service

class MyService(Service):
    async def start(self):
        do_something_when_start()

    async def stop(self, exc):
        do_graceful_shutdown()


with entrypoint(MyService()) as loop:
    loop.run_forever()

The entry point can start as many instances of the service as it likes, and all of them will start concurrently.

There is also a way if the start method is a payload for a service, and then there is no need to implement the stop method, since the running task with the start function will be canceled at the stop stage. But in this case, you will have to notify the entrypoint that the initialization of the service instance is complete and it can continue.

Like this:

import asyncio
from threading import Event
from aiomisc import entrypoint, Service

event = Event()

class MyService(Service):
    async def start(self):
        # Send signal to entrypoint for continue running
        self.start_event.set()
        await asyncio.sleep(3600)


with entrypoint(MyService()) as loop:
    assert event.is_set()

The whole power of this library is in the set of already implemented or abstract services. Such as: AIOHTTPService, ASGIService, TCPServer, UDPServer, TCPClient, PeriodicService, CronService and so on.

Unfortunately in this section it is not possible to pay more attention to this, please pay attention to the Tutorial section section, there are more examples and explanations, and of cource you always can find out an answer on the /api/index or in the source code. The authors have tried to make the source code as clear and simple as possible, so feel free to explore it.

Versioning

This software follows Semantic Versioning

Summary: it’s given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes

  • MINOR version when you add functionality in a backwards compatible manner

  • PATCH version when you make backwards compatible bug fixes

  • Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

In this case, the package version is assigned automatically with poem-plugins, it using on the tag in the repository as a major and minor and the counter, which takes the number of commits between tag to the head of branch.

How to develop?

This project, like most open source projects, is developed by enthusiasts, you can join the development, submit issues, or send your merge requests.

In order to start developing in this repository, you need to do the following things.

Should be installed:

  • Python 3.7+ as python3

  • Installed Poetry as poetry

For setting up developer environment just execute:

# installing all dependencies
poetry install

# setting up pre-commit hooks
poetry run pre-commit install

# adding poem-plugins to the poetry
poetry self add poem-plugins
18.0.19 Mar 23, 2026
18.0.17 Mar 18, 2026
18.0.15 Mar 18, 2026
18.0.6 Feb 09, 2026
18.0.0 Feb 09, 2026
17.10.9 Feb 09, 2026
17.10.3 Jan 13, 2026
17.10.2 Jan 13, 2026
17.9.18 Jan 13, 2026
17.9.9 Nov 21, 2025
17.9.6 Oct 27, 2025
17.9.4 Aug 02, 2025
17.9.3 Aug 02, 2025
17.9.1 Jul 29, 2025
17.9.0 Jan 13, 2026
17.8.1 Jul 23, 2025
17.7.8 Jul 07, 2025
17.7.7 Apr 01, 2025
17.7.6 Apr 01, 2025
17.7.5 Apr 01, 2025
17.7.3 Mar 03, 2025
17.7.1 Mar 03, 2025
17.6.3 Feb 10, 2025
17.6.1 Feb 10, 2025
17.5.31 Dec 31, 2024
17.5.30 Dec 29, 2024
17.5.29 Nov 28, 2024
17.5.28 Nov 28, 2024
17.5.27 Nov 28, 2024
17.5.26 Aug 13, 2024
17.5.25 Jul 19, 2024
17.5.24 Jun 04, 2024
17.5.23 Jun 04, 2024
17.5.22 Jun 04, 2024
17.5.21 Jun 04, 2024
17.5.20 Jun 04, 2024
17.5.19 May 14, 2024
17.5.17 May 14, 2024
17.5.15 May 07, 2024
17.5.12 May 07, 2024
17.5.10 May 07, 2024
17.5.8 May 07, 2024
17.5.6 Apr 18, 2024
17.5.4 Mar 14, 2024
17.5.2 Mar 11, 2024
17.4.1 Mar 07, 2024
17.3.48 Mar 07, 2024
17.3.41 Nov 21, 2023
17.3.39 Nov 21, 2023
17.3.37 Nov 21, 2023
17.3.34 Nov 21, 2023
17.3.25 Nov 15, 2023
17.3.24 Nov 15, 2023
17.3.23 Sep 28, 2023
17.3.21 Jul 24, 2023
17.3.18 Jul 24, 2023
17.3.16 Jul 20, 2023
17.3.14 Jul 20, 2023
17.3.10 Jul 20, 2023
17.3.4 Jul 10, 2023
17.3.2 Jun 01, 2023
17.3.0 May 24, 2023
17.2.9 May 23, 2023
17.2.8 May 23, 2023
17.2.6 May 23, 2023
17.2.4 May 23, 2023
17.2.2 May 01, 2023
17.1.4 Apr 23, 2023
17.1.3 Apr 23, 2023
17.1.2 Apr 18, 2023
17.1.0 Apr 15, 2023
17.0.9 Apr 07, 2023
17.0.8 Mar 20, 2023
17.0.6 Feb 18, 2023
17.0.4 Feb 18, 2023
17.0.3 Feb 16, 2023
17.0.0 Feb 16, 2023
16.3.15 Feb 01, 2023
16.3.9 Jan 31, 2023
16.3.7 Jan 26, 2023
16.3.6 Jan 23, 2023
16.3.5 Jan 23, 2023
16.3.2 Jan 23, 2023
16.3.1 Jan 23, 2023
16.3.0 Jan 23, 2023
16.2.10 Nov 30, 2022
16.2.9 Nov 16, 2022
16.2.8 Nov 14, 2022
16.2.6 Nov 07, 2022
16.2.5 Nov 03, 2022
16.2.4 Aug 26, 2022
16.2.3 Aug 26, 2022
16.2.2 Aug 26, 2022
16.2.1 Aug 11, 2022
16.2.0 Aug 10, 2022
16.1.17 Aug 03, 2022
16.1.15 Aug 03, 2022
16.1.14 Aug 03, 2022
16.1.13 Aug 03, 2022
16.1.12 Aug 03, 2022
16.1.8 Jul 11, 2022
16.1.7 Jun 29, 2022
16.1.5 Jun 14, 2022
16.1.4 Jun 14, 2022
16.1.3 Jun 14, 2022
16.1.2 Jun 14, 2022
16.1.1 Jun 14, 2022
16.0.13 May 29, 2022
16.0.10 May 26, 2022
16.0.8 May 24, 2022
16.0.4 May 11, 2022
15.9.5 May 10, 2022
15.9.4 May 10, 2022
15.9.3 May 10, 2022
15.9.1 May 05, 2022
15.8.2 May 05, 2022
15.8.0 Apr 05, 2022
15.7.3 Mar 15, 2022
15.7.2 Mar 11, 2022
15.7.1 Mar 09, 2022
15.6.8 Jan 24, 2022
15.6.7 Dec 27, 2021
15.6.6 Dec 27, 2021
15.6.5 Dec 27, 2021
15.6.4 Dec 27, 2021
15.6.2 Dec 16, 2021
15.5.0 Dec 14, 2021
15.4.9 Dec 14, 2021
15.4.8 Nov 16, 2021
15.4.7 Nov 15, 2021
15.4.1 Nov 15, 2021
15.3.2 Nov 11, 2021
15.2.16 Oct 30, 2021
15.2.15 Oct 30, 2021
15.2.14 Oct 29, 2021
15.2.10 Oct 29, 2021
15.2.4 Oct 25, 2021
15.2.3 Oct 21, 2021
15.1.3 Oct 18, 2021
15.1.2 Oct 18, 2021
15.1.0 Oct 18, 2021
15.0.7 Oct 18, 2021
15.0.6 Oct 16, 2021
15.0.5 Oct 15, 2021
15.0.3 Oct 15, 2021
15.0.2 Oct 15, 2021
15.0.1 Oct 15, 2021
14.4.6 Sep 20, 2021
14.4.3 Sep 13, 2021
14.4.2 Aug 23, 2021
14.4.1 Aug 10, 2021
14.4.0 Aug 09, 2021
14.3.16 Aug 02, 2021
14.3.12 Aug 02, 2021
14.3.2 Jul 27, 2021
14.2.0 Jul 26, 2021
14.1.8 Jul 15, 2021
14.1.0 May 31, 2021
14.0.7 May 19, 2021
14.0.3 Apr 30, 2021
14.0.0 Apr 30, 2021
13.0.0 Apr 27, 2021
12.1.0 Mar 02, 2021
12.0.0 Feb 18, 2021
11.2.0 Feb 16, 2021
11.1.11 Jan 11, 2021
11.1.0 Nov 09, 2020
11.0.0 Oct 06, 2020
10.2.0 Aug 12, 2020
10.1.6 Jul 28, 2020
10.1.0 Jul 03, 2020
10.0.8 May 27, 2020
10.0.1 May 21, 2020
10.0.0 May 12, 2020
9.8.4 May 08, 2020
9.8.1 May 07, 2020
9.7.8 Apr 01, 2020
9.7.7 Mar 17, 2020
9.7.5 Feb 13, 2020
9.7.2 Feb 13, 2020
9.7.1 Feb 13, 2020
9.7.0 Feb 13, 2020
9.6.36 Feb 10, 2020
9.6.34 Feb 07, 2020
9.6.29 Feb 06, 2020
9.6.11 Jan 28, 2020
9.6.8 Dec 17, 2019
9.6.3 Nov 29, 2019
9.6.0 Nov 12, 2019
9.4.2 Oct 31, 2019
9.4.1 Oct 30, 2019
9.3.0 Oct 25, 2019
9.2.15 Oct 25, 2019
9.2.7 Oct 24, 2019
9.2.6 Oct 17, 2019
9.2.4 Oct 16, 2019
9.2.0 Oct 01, 2019
8.0.3 Sep 04, 2019
8.0.1 Sep 02, 2019
8.0.0 Jul 11, 2019
7.2.5 May 22, 2019
7.2.0 May 16, 2019
7.1.0 May 13, 2019
7.0.3 May 08, 2019
7.0.1 May 07, 2019
6.0.6 Apr 29, 2019
6.0.4 Apr 10, 2019
5.5.1 Apr 03, 2019
5.4.29 Mar 28, 2019
5.4.26 Mar 18, 2019
5.4.20 Feb 28, 2019
5.4.16 Feb 27, 2019
5.4.14 Feb 19, 2019
5.4.10 Feb 15, 2019
5.4.9 Feb 15, 2019
5.4.8 Feb 15, 2019
5.4.0 Feb 07, 2019
5.3.4 Feb 06, 2019
5.3.2 Feb 06, 2019
5.3.0 Jan 30, 2019
5.2.5 Jan 23, 2019
5.2.3 Jan 23, 2019
5.2.2 Jan 22, 2019
5.2.1 Jan 22, 2019
5.2.0 Jan 22, 2019
5.1.6 Jan 22, 2019
5.1.5 Jan 22, 2019
5.1.4 Jan 22, 2019
5.1.3 Jan 19, 2019
5.0.0 Jan 19, 2019
4.2.16 Jan 19, 2019
4.1.0 Jan 18, 2019
4.0.0 Jan 17, 2019
3.0.0 Jan 16, 2019
2.1.7 Jan 13, 2019
2.1.6 Jan 13, 2019
2.1.5 Jan 13, 2019
2.1.0 Jan 10, 2019
2.0.0 Jan 10, 2019
1.9.6 Jan 10, 2019
1.9.3 Jan 10, 2019
1.9.2 Jan 10, 2019
1.9.1 Jan 10, 2019
1.7.0 Jan 10, 2019
1.6.0 Jan 09, 2019
1.5.1 Jan 09, 2019
1.5.0 Jan 09, 2019
1.4.0 Jan 04, 2019
1.3.9 Dec 25, 2018
1.3.3 Dec 24, 2018
1.3.0 Dec 10, 2018
1.1.2 Dec 06, 2018
1.1.0 Dec 06, 2018
1.0.7 Nov 20, 2018
1.0.4 Nov 06, 2018
1.0.3 Oct 26, 2018
0.11.11 Oct 26, 2018
0.11.9 Oct 17, 2018
0.11.7 Oct 17, 2018
0.11.4 Oct 16, 2018
0.11.0 Oct 16, 2018
0.10.6 Oct 11, 2018
0.10.5 Oct 11, 2018
0.10.4 Oct 11, 2018
0.10.0 Sep 13, 2018
0.9.8 Aug 23, 2018
0.8.3 Aug 20, 2018
0.8.2 Aug 20, 2018
0.8.0 Aug 07, 2018
0.7.4 Aug 06, 2018
0.7.3 Aug 01, 2018
0.7.2 Aug 01, 2018
0.7.0 Aug 01, 2018
0.6.8 Aug 01, 2018
0.6.7 Jul 31, 2018
0.6.1 Jul 30, 2018
0.5.2 Jul 27, 2018
0.5.1 Jul 27, 2018
0.5.0 Jul 27, 2018
0.4.6 Jul 25, 2018
0.4.4 May 30, 2018
0.4.3 May 23, 2018
0.4.0 May 11, 2018
0.3.0 May 08, 2018
0.2.6 Apr 17, 2018
0.2.1 Apr 13, 2018
0.2.0 Apr 13, 2018
0.1.0 Apr 13, 2018

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
aiothreads (>=1.0.0)
colorlog (<7,>=6.0)
logging-journald