Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🪐 In the constellation Ophiuchus, the asteroid 101955 Bennu harbors boulders on its surface that are actually fragments from a much larger parent asteroid, dislodged by ancient cosmic impacts. Analysis of samples returned by NASA’s OSIRIS-REx mission revealed minerals that interacted with liquid water billions of years ago, revealing Bennu as a time capsule from the dawn of the solar system. ✨
#Bennu⚡#asteroids⚡#OSIRISRex
👉subscribe Universe Mysteries
🪐 One of the most intriguing potentially hazardous asteroids is (101955) Bennu, a 500-meter-wide space rock that approaches Earth every six years. Bennu's orbit is so well-studied that NASA sent the OSIRIS-REx mission to collect samples, as even small forces—like sunlight changing its spin—can alter its path, making Bennu a prime real-world example of why scientists keep a close watch on these cosmic wanderers. ✨
#asteroids⚡#hazard⚡#Bennu⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐A skyscraper-sized space rock is on its way past Earth.
On September 18, 2025, asteroid 2025 FA22, measuring up to 300 meters across, will sweep by our planet. At its closest, it will be about 835,000 km away — more than twice the distance to the Moon.
Moving at a breathtaking 34,000 km/h, this Apollo-type asteroid silently follows its orbit around the Sun, crossing Earth’s path in space. The flyby will peak around 07:41 UTC, a moment astronomers worldwide are watching closely.
Massive, fast, and ancient — yet passing safely by. Encounters like this remind us how close cosmic giants can come, while still leaving Earth untouched. ✨
#asteroids⚡#hazard⚡#Bennu⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 The asteroid Bennu, about 500 meters wide, orbits the Sun and regularly passes close to Earth—so close that it’s classified as a “potentially hazardous asteroid.” Scientists continually monitor Bennu’s path because even small shifts caused by sunlight (known as the Yarkovsky effect) could alter its future trajectory, making it one of the most closely watched objects to help protect our planet from possible impacts. ✨
#asteroid⚡#hazards⚡#Bennu⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 One of the closest ongoing space threats to Earth is asteroid (101955) Bennu, a 500-meter-wide rock whose orbit brings it near our planet about every six years. Bennu's path is carefully tracked because even small gravitational nudges or sunlight (the Yarkovsky effect, where heat causes tiny pushes) could change its future route, making it a real-world example of why scientists keep a vigilant watch on these near-Earth objects. ✨
#asteroids⚡#defense⚡#Bennu⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels