Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🌎 The disappearance of the Sodder children in 1945 remains unsolved. Five siblings vanished after a house fire in Fayetteville, West Virginia. Investigators found no remains in the ash, and sightings were later reported but never verified. A billboard seeking answers stood along Route 16 for decades. ✨
#history⚡#disappearance⚡#mystery
👉subscribe Interesting Planet
🌎 In 2009, French aircraft Air France Flight 447 disappeared over the Atlantic during a flight from Rio de Janeiro to Paris. All 228 people on board died. The plane's wreckage was not found for nearly two years, when deep-sea searches located the main debris field at a depth of 3,900 meters. ✨
#aviation⚡#disappearance⚡#ocean
👉subscribe Interesting Planet
👉more Channels
🌎 In 1815, the British brig HMS Rosalie was found abandoned and drifting near the Bahamas. The ship’s sails were set, and cargo untouched, but not a single crew member was found onboard. Official records note that the ship’s logbook and personal belongings were still present when discovered. ✨
#disappearance⚡#maritime⚡#mystery
👉subscribe Interesting Planet
🌎 In 1973, Australian pilot Frederick Valentich disappeared while flying a Cessna 182L over Bass Strait. During radio contact, he reported a strange, unidentified craft circling his plane before transmission was lost. Despite a large search, neither Valentich nor his aircraft were ever found. ✨
#disappearance⚡#aviation⚡#australia
👉subscribe Interesting Planet
👉more Channels
🌎 In 1872, the Mary Celeste was found adrift in the Atlantic Ocean—its crew vanished without a trace, leaving food, cargo, and the ship untouched. This unsolved maritime mystery has puzzled historians ever since. ✨
#disappearance⚡#ship⚡#mystery
👉subscribe Interesting Planet
🌎 In 1925, British explorer Percy Fawcett vanished in Brazil's Amazon rainforest while searching for the lost city of "Z." Fawcett, his son, and a companion were last seen near the Upper Xingu River. Despite dozens of rescue missions over decades, no confirmed trace of the expedition was ever found. ✨
#amazon⚡#disappearance⚡#exploration
👉subscribe Interesting Planet
👉more Channels