Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🚗✨ Introducing the stunning Pagani Utopia Roadster! 🌟
This masterpiece trades its traditional roof for a removable panel featuring a sleek glass insert. 🪟 For those who prefer a classic touch, there’s an alternative fabric top that neatly stores in its own case. 🎒
With no need for extra reinforcement, the Utopia's inherent strength shines through in this exquisite design. 💪
Under the hood, this beauty packs a powerful punch with an 864-hp V12 engine from Mercedes-AMG! 🔥💨
Get ready to own this automotive marvel for a cool €3.1 million! 💰
#PaganiUtopia#Roadster#Supercar#Auto#CarEnthusiast#DreamCar#ExoticCars#Pagani
🚙✨For Sale: Brabus 900 XLP!✨🚙
Get ready to own a masterpiece! This exclusive pickup, built on the Mercedes-AMG G 63 platform, boasts a staggering 900 horsepower and only 10 units produced! 🚀
📍Mileage: 3,375 km
💰Price: Nearly $1 million
Under the hood, it features a custom-built engine based on the stock V8, with an increased displacement of 4.5 liters, custom turbocharging, and upgraded components for unmatched performance! 🔥
#Brabus900XLP#LuxuryCars#ForSale#SuperPickup#CarEnthusiast#ExoticCars#MercedesAMG#DreamCar#Auto
🚗💨Unleash the Beast: 1600 HP Lamborghini Aventador SVJ!🦙🔥
For those who crave power and performance, Underground Racing Motors is offering a jaw-dropping 1600-horsepower Lamborghini Aventador SVJ for just $1.7 million!💰✨
Originally launched over six years ago, the Aventador SVJ boasts a naturally aspirated 6.5L V12 engine producing 770 HP and 720 Nm of torque. But with the magic of twin-turbocharging and expert tuning, this beast can roar up to an astonishing 1600 HP when fueled with race gas! 🏁💥 On regular gasoline, it still impresses with 1250 HP!
#Lamborghini#AventadorSVJ#UndergroundRacing#Supercar#CarEnthusiast#LuxuryCars#TurboPower#Hypercar#DreamCar#Auto
🚗✨For Sale: Aston Martin Vanquish!✨🚗
This stunning grand tourer isn't just any car; it was featured in a promotional photoshoot for the James Bond film "Die Another Day" starring Pierce Brosnan! 🌟
🔹Power: 460 HP
🔹Mileage: Over 60,000 km
🔹Price: Up to $100,000
Don't miss your chance to own a piece of cinematic history! 🎬💎
#AstonMartin#Vanquish#JamesBond#DieAnotherDay#LuxuryCars#CarForSale#BondCar#DreamCar#Auto
🏎 Get your hands on a piece of history! 🌟
Rare Lamborghini Countach LP400 up for auction! Previously owned by musician Rod Stewart.
Only around 150 LP400 Countach models were ever produced by Lamborghini, featuring a 3.9-liter V12 engine with 370 horsepower. Rod Stewart was the proud first owner of this incredible car, purchasing it in Australia during his tours and then bringing it back to the UK.
💲 Price: $520,000 💲
⏳ Only one day left until the end of the auction! ⏳
#Lamborghini#Countach#LP400#RodStewart#RareCar#MusicianOwned#Auction#DreamCar#MuscleCar#Legendary#CollectorCar