Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🌎 An ancient mystery lingers at the center of our galaxy—a supermassive black hole called Sagittarius A*. Its powerful gravity bends space and time, hiding beyond a swirling cloud of stars and gas. This invisible giant shapes the Milky Way, anchoring everything around it with immense, unseen force. ✨
#space⚡#blackhole⚡#universe
👉subscribe Interesting Planet
🌎 In 2020, astronomers detected a mysterious object named “The Cow,” a fast and extremely bright stellar explosion. Unlike normal supernovas, “The Cow” rapidly peaked in brightness, confounding scientists. Follow-up observations revealed it was likely the birth of a black hole or neutron star—providing a rare view of a star’s collapse in real time. ✨
#astronomy⚡#supernova⚡#blackhole
👉subscribe Interesting Planet
👉more Channels
BlackHole
Music Player made with Flutter
Features
Best Streaming Quality (320kbps)
Music Search
Trending Songs
Support 15+ music languages
Local and Global Top Spotify songs
Add Songs to Favorite
Playlists support
Import Playlists from Spotify
Sleep timer
Lyrics Support
Listening history record
Dark mode / accent color
Download for offline play (320kbps with ID3 tags)
Play Online as well as Offline Songs
Queue Management
Auto Update Check
Cache support
No Subscription
No Ads
More to come...
Download https://github.com/Sangwan5688/BlackHole/releases
Channel @blackhole_channel
Group https://t.me/joinchat/fHDC1AWnOhw0ZmI9
#BlackHole#Music#Player
🌎 At the center of our Milky Way galaxy lies Sagittarius A*, a supermassive black hole around 4 million times the mass of the Sun. It exerts a powerful gravitational pull, causing nearby stars to orbit at incredible speeds—some over 5,000 kilometers per second. ✨
#astronomy⚡#blackhole⚡#galaxy
👉subscribe Interesting Planet
👉more Channels
🪐 The galaxy NGC 1277 in the Perseus constellation harbors an ultramassive black hole that makes up a staggering 14% of its entire mass—a proportion far greater than in any typical galaxy. This enigmatic black hole has puzzled scientists, as such a gigantic ratio defies cosmic norms and hints at a forgotten chapter in the history of galactic evolution. ✨
#galaxies⚡#blackhole⚡#mystery
👉subscribe Universe Mysteries
🪐 The dusty core of the elliptical galaxy Centaurus A (NGC 5128) hides a colossal jet of high-energy particles, launched from a supermassive black hole and stretching over 1 million light-years into intergalactic space. X-ray and radio images reveal this jet carving through the surrounding gas, shaping the galaxy’s strange appearance and fueling vast lobes that glow in the cosmic void. ✨
#CentaurusA⚡#blackhole⚡#galaxy
👉subscribe Universe Mysteries
🪐 In the galaxy SDSS J135154.46+132719.1, astronomers have observed a striking phenomenon: a supermassive black hole that was caught being "kicked" out of its galaxy at nearly 7.5 million kilometers per hour. This cosmic eviction is thought to be caused by the merged black holes’ gravitational waves pushing the giant object away—an extreme event where the very heart of a galaxy is flung into intergalactic space. ✨
#phenomena⚡#galaxy⚡#blackhole⚡#nasa⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🌎 Deep within the constellation Cygnus, the black hole V404 Cygni occasionally unleashes powerful outbursts, ejecting matter at near light-speed in opposing jets. These rare events are so energetic that the black hole briefly outshines its entire host galaxy, offering a fleeting glimpse into the turbulent ballet around stellar remnants. ✨
#blackhole⚡#cygnus⚡#jets
👉subscribe Universe Mysteries
🪐 In the Perseus Cluster, a supermassive black hole at the center of the galaxy NGC 1275 sends out powerful sound waves that ripple through the surrounding gas. These cosmic vibrations have wavelengths so vast—spanning around 30,000 light-years—that they produce the deepest note ever detected, 57 octaves below middle C, making it a real, albeit inaudible, “song” of the universe. ✨
#PerseusCluster⚡#blackhole⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries