Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
#Iceland🇮🇸
A special place in Iceland is considered to be the black beach. It was here that such cult movies as "The Lord of the Rings", "Game of Thrones" and "Star Wars" were filmed. The black beach was formed as a result of volcanic activity. This event happened many years ago
#Iceland, Gudlfoss 🇮🇸
Gyudlfoss is a waterfall in Iceland, in the Syudurland region.
The depth of the waterfall to the place of water falling in the valley is about 70 meters. The Güdlfoss itself consists of two steps - 21 meters and 11 meters high, dumped to each other at an angle of 90 °.
It is considered one of the most beautiful places in Iceland and is the most visited tourists.
🌟Breathtaking Views of Iceland!
🟠A mesmerizing landscape where a powerful waterfall meets silent green hills and dramatic clouds on the horizon.
🟠Nature here stuns with its beauty and scale, offering perfect spots for adventure seekers and photography enthusiasts. Feel the grandeur and tranquility of these magnificent landscapes!
#Iceland | @voyage
🗺 Iceland 🇮🇸
Following a recent volcanic eruption, the main highway to the Icelandic town of Grindavík is now impassable, and the surrounding area is covered in lava for several kilometers.
#Iceland | @voyage
Iceland🇮🇸
🟠A canyon located in the Jokuldalur Valley, Iceland.
🟠It is famous for its columnar basalt formations and blue-green water.
#Iceland | @voyage
Iceland🇮🇸
🟠A canyon located in the Jokuldalur Valley, Iceland.
🟠It is famous for its columnar basalt formations and blue-green water.
#Iceland | @voyage
Iceland 🇮🇸
🟠After the eruption of Eldfell volcano on Heimaey Island, a stunning natural wonder emerged — a rock formation shaped like an elephant drinking from the Atlantic.
📏
📏
📏
📏
📏
📏
📏
📏
#Iceland | @voyage
⚡️Hallgrímskirkja – a majestic church in the heart of Reykjavík! ✨🏔️
🟠Inside, it houses a massive pipe organ with 5,275 pipes, standing 15 meters tall and weighing 25 tons – a true musical masterpiece!
📏
📏
📏
📏
📏
📏
📏
📏
#Iceland | @voyage
✨ Hallgrímskirkja — the highest point in Reykjavik.
🟠Imagine a majestic church rising above the city like a guardian of time. Its unique architecture and panoramic views of Reykjavik make it a must-visit place.
📏
📏
📏
📏
📏
📏
📏
📏
#Iceland🇮🇸@voyage