Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
Do not save your drugs for later or share them with another person.
Ensure you complete your dosage as prescribed by a certified healthcare worker.
Play your part to prevent #AntimicrobialResistance.
Dear Healthcare Workers,
Remember that many infections present with similar signs and symptoms. Always maintain a high index of suspicion.
To prevent #AntimicrobialResistance, conduct a test before you treat a patient.
Dear Healthcare Workers,
Remember that many infections present with similar signs and symptoms. Always maintain a high index of suspicion.
To prevent #AntimicrobialResistance, conduct a test before you treat a patient.
#AntimicrobialResistance is a global health issue leading to the ineffectiveness of drugs against the illness they were developed to treat.
Health care practitioners should always conduct a test before prescribing treatment for a patient
Do not save your drugs for later or share them with another person.
Ensure you complete your dosage as prescribed by a healthcare worker.
Play your part to prevent #AntimicrobialResistance.
Do not save your drugs for later or share them with another individual
Complete your dosage as prescribed by a healthcare worker.
Play your part to prevent #AntimicrobialResistance.
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian.
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
The misuse and overuse of #antibiotics💊 & other antimicrobials reduces their effectiveness in treating common infections in animals & humans.
Everyone has a role to play to help fight #AntimicrobialResistance, do your part!
Misuse or overuse of #antibiotics💊 & other antimicrobials can reduce their effectiveness in treating common infections in animals & humans.
Everyone has a role to play to help fight #AntimicrobialResistance, do your part!