Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
Russian Defence Ministry (@mod_russia_en):
❗️Statement by Russian Defence Ministry
▪️ On March 14, at about 11.30 a.m. Moscow time, Tochka-U tactical missile was fired at a residential block of Donetsk city from the territory controlled by the Kiev nationalist regime.
▪️ The shelling of the city was carried out from the north-western direction, from the area of Krasnoarmeysk settlement, which is controlled by Ukrainian nationalist units.
▪️ As a result of the explosion of a cluster warhead in the center of Donetsk, 20 civilians were killed. Another 28 people, including children, were seriously injured and taken to medical institutions.
▪️ The use of such weapons on a town with no armed forces firing positions, i.e. deliberately targeting civilians, is a war crime.
#Ukraine#Donetsk#WarCrime
How a Secluded 1984 Conference Forged Israel’s Unprecedented Influence Over US Media
October 31st, 2024
By Kit Klarenberg
.
In the first week of January 2024, Israeli forces fired 355 bullets at a car containing a five-year-old, then shot at rescue workers who rushed to save her life.
An indisputible act of murder, a definite #WarCrime – yet, per many Western media headlines, she was simply a “girl killed in Gaza.”
The circumstances and perpetrators of her death, if mentioned at all, were invariably buried at the bottom of reports, well hidden from the 80% of the news-consuming public who only read headlines.
In contrast, on October 15 2024, Sky News was very keen that its viewers know the names and faces of four “teenage” #IDF soldiers “killed” in a “#Hezbollah#drone attack,” humanizing and infantilizing individuals who, by mere token of their service in Israel’s military, are by definition, guilty of genocide. ..... (read more....)
🇺🇸#USA
#US#Senator#LindseyGraham voices his fear that, due to the International Criminal Court's (#ICC) #WarCrime Charges against Israeli PM #Netanyahu, there might after all even be some adverse #legal consequences for both his own, and his country's, illegal War actions.
"If they'll do this to Israel, we're next."