Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🚀 U.S. President Donald Trump Anticipates Imminent Peace Agreement with Iran
U.S. President Donald Trump has conveyed a positive outlook regarding the potential for a peace agreement with Iran. According to NS3.AI, Trump believes that negotiations are progressing favorably, suggesting that a resolution may be reached soon. This development comes amid ongoing diplomatic efforts to address tensions between the two nations. The President's remarks highlight a significant shift in the geopolitical landscape, with implications for international relations and regional stability.
#DonaldTrump#Iran#PeaceAgreement#Diplomacy#InternationalRelations#Geopolitics#MiddleEast#Negotiations#RegionalStability
🚀 Iran Expresses Readiness for Regional Peace Agreement
Iranian President Ebrahim Raisi has expressed the country's readiness to establish a balanced and fair agreement to ensure lasting peace and security in the region. According to BlockBeats, this statement was made during a phone conversation with Russian President Vladimir Putin on April 12, as reported by Iran's Tasnim News Agency.
#Iran#EbrahimRaisi#VladimirPutin#RegionalPeace#Security#PeaceAgreement#IranRussia#BlockBeats#TasnimNews
🚀 Middle East Ceasefire Expected to Hold Despite Fragility
Jefferies global economist Mohit Kumar has stated that despite the fragility of the Middle East ceasefire agreement, it is expected to hold. According to Odaily, Kumar noted that both parties have reached a point where they desire a ceasefire, as continued conflict would negatively impact both sides.
Kumar highlighted that U.S. President Donald Trump is keen on reaching an agreement, as he lacks support from his core base for ongoing warfare. Meanwhile, the Iranian Revolutionary Guard faces challenges due to economic devastation, potentially paving the way for future uprisings. He concluded that given the interests of both parties, the unstable ceasefire is likely to persist.
#MiddleEast#Ceasefire#MohitKumar#US#Iran#DonaldTrump#Conflict#RevolutionaryGuard#GlobalEconomics#PeaceAgreement#Odaily
🚀 STOCKS | S&P 500 Rises for Seventh Day Amid U.S.-Iran Peace Deal Optimism
The S&P 500 extended its gains for the seventh consecutive session, buoyed by growing optimism about a potential long-term peace agreement between the U.S. and Iran. Wall Street Journal (Markets) posted on X, highlighting the positive sentiment among investors as diplomatic efforts continue to progress. The sustained rally in the S&P 500 reflects investor confidence in the potential easing of geopolitical tensions, which could have significant implications for global markets. Analysts suggest that a successful peace deal could lead to increased stability in the region, potentially benefiting various sectors, including energy and defense. As negotiations advance, market participants remain attentive to developments that could influence future market movements.
#SP500#USIranPeaceDeal#WallStreet#GeopoliticalTensions#MarketOptimism#EnergySector#DefenseSector#InvestorsConfidence#GlobalMarkets#PeaceAgreement#DiplomaticEfforts
Premiering now: The Standard Signal | Ep.14: Tigray on the Brink: Survival, Famine Risks, and the Shadow of Renewed War in Ethiopia.
Click here to watch: https://www.youtube.com/watch?v=YDjUomfsWnA
Tigray is facing fragile recovery, deepening humanitarian strain, and growing fears of renewed war.
In this episode of The Standard Signal, Duke Burbridge shares what he witnessed on the ground — from survival and displacement to aid challenges and famine risks.
#StandardSignal#EthiopiaPolitics#ONLF#Ogaden#PeaceAgreement#PoliticalRepression#ShrinkingCivicSpace#ResourcePolitics#OilAndGas#Federalism#DemocracyInEthiopia#HornOfAfrica#Accountability#PoliticalDialogue#Tigray