Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
@RusEmbMalta Press Release
✖️Examples of Actions by the Kiev Regime Undermining Peace Efforts
Following President Trump’s meetings with President Vladimir Putin (Alaska, 15 August) and Vladimir Zelensky (Washington, 18 August), he described the talks as “a good first step” towards ending the conflict. He stressed that Kiev must show flexibility, confirmed Ukraine will not join NATO, and highlighted the importance of territorial compromises along the current line of contact.
👉 Despite these statements, the Kiev leadership – with European backing – continues to obstruct a peaceful settlement:
1️⃣ Refusal to Recognize New Realities
Zelensky (21 Aug): Ukraine will “never legally recognize” Russian control of territories. Yermak & Podolyak echoed this, rejecting compromise.
2️⃣Rejection of Ceasefire
Zelensky announced mass production of long-range Flamingo missiles; later praised strikes into Russian territory as “positive results.”
3️⃣ Language Policy
Zelensky: “We have only one state language – Ukrainian.”
4️⃣Security Guarantees
Zelensky dismissed China as a potential guarantor, while Podolyak demanded deployment of Western missiles capable of striking 2,000 km into Russian territory. NATO Secretary General Mark Rutte confirmed that Western military support and long-term guarantees for Kiev are being discussed.
5️⃣No Readiness for Direct Talks
Zelensky ruled out bilateral talks with Moscow, insisting on a three-party format with Trump.
6️⃣Attacks on Civilian Infrastructure
Attempts to strike nuclear facilities in Smolensk & Kursk, attack on Druzhba oil pipeline (impacting Hungary & Slovakia), and a planned bombing of the Crimean Bridge.
⚠️Conclusion:
The Kiev regime consistently rejects diplomatic resolution, escalates hostilities, undermines dialogue, and employs terrorist methods against civilian infrastructure in Russia.
#KievRegime#GlobalSecurity#MultipolarWorld
Iranian regime promises $25 million for assassination of Trump in mass SMS messages
[Read FullArticle]
@WorldNews#IranNews#TrumpAssassination#GlobalSecurity
Zelenskyy says 10 drone factories have been built worldwide behind Ukraine’s back | Ukrainska Pravda
[Read FullArticle]
@WorldNews#UkraineNews#DroneFactories#GlobalSecurity
U.S. can only confirm about a third of Iran's missile arsenal destroyed, sources say
[Read FullArticle]
@WorldNews#IranMissileArsenal#USNews#GlobalSecurity
China urges US, Israel to stop military action in Middle East, warns of 'vicious cycle'
[Read FullArticle]
@WorldNews#MiddleEastConflict#ChinaUSRelations#GlobalSecurity
Treasury secretary defends U.S. military actions in Iran: 'Sometimes you have to escalate to de-escalate'
[Read FullArticle]
@WorldNews#USIranTensions#MilitaryAction#GlobalSecurity