Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
🪐 The Hubble Space Telescope has helped reveal that most of the universe’s mass is invisible, made up of “dark matter”—an unknown substance detected only by its gravity, which bends light from faraway galaxies in a process called gravitational lensing. Even more mysterious is “dark energy,” discovered through distant supernovae in galaxies like Messier 81, which acts like a force pushing galaxies apart and causing the universe’s expansion to speed up, reshaping our entire understanding of the cosmos. ✨
#darkmatter⚡#darkenergy⚡#universe⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The ultimate fate of the universe may come in a dramatic event known as the "Big Rip," where the repulsive force of dark energy—an unseen force causing galaxies like Sombrero Galaxy (Messier 104) to speed away from each other—could grow so strong that it eventually tears apart galaxy clusters, stars, planets, and even atoms themselves. If the Big Rip happens, it would be the final act in cosmic history, ending everything from the largest galaxy clusters down to the smallest subatomic particles in a relentless expansion. ✨
#universe⚡#darkenergy⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Scientists have used distant supernovae like those in the galaxy NGC 4526 to measure how the mysterious force called dark energy is making the universe expand faster and faster. If this acceleration continues, all galaxies—including NGC 4526, Messier 87, and our own Milky Way—will someday move so far apart that their light can never reach each other again, leading to a lonely, cold, and ever-darkening universe known as "cosmic isolation." ✨
#darkenergy⚡#universe⚡#fate⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The universe's fate is still being explored, but observations of galaxies like Messier 87, which are drifting farther apart, show that space itself is expanding faster and faster due to a mysterious force called dark energy. As expansion pushes galaxies beyond view and the last stars—such as our Sun—burn out, the cosmos will grow colder and emptier, leading to an era where only black holes like Sagittarius A* remain, before even they slowly fade away over unimaginable timescales. ✨
#universe⚡#fate⚡#darkenergy⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The ultimate fate of the Universe may be driven by dark energy, a mysterious force making galaxies like our Milky Way and Andromeda fly apart ever faster. If expansion continues to accelerate, distant galaxies will disappear beyond our view and stars will eventually burn out, leaving behind cold remnants like white dwarfs and black holes—an era sometimes called the "heat death" or "Big Freeze," when the cosmos grows dark and nearly motionless. ✨
#universe⚡#fate⚡#darkenergy⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Deep in the Coma Cluster, a packed group of over 1,000 galaxies, astronomers have measured how dark energy—a mysterious force causing the universe to expand faster over time—stretches the space between galaxies. Observations show that the distance between massive galaxies in the Coma Cluster grows not just from their own motion, but because dark energy is steadily pushing the entire cosmic structure apart. ✨
#darkenergy⚡#galaxyclusters⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Scientists studying the distant galaxy cluster MACS J1149+2223 use it as a window into the fate of the cosmos, tracking how the accelerated expansion driven by dark energy might eventually push galaxies so far apart that their light can never reach each other again. Over unimaginable timescales, clusters like MACS J1149+2223 will fade from view as the universe expands, leaving behind only a cold, dark emptiness—an ending known as "cosmic isolation" that awaits even the brightest galaxies. ✨
#universe⚡#expansion⚡#darkenergy⚡#galaxycluster⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Within the distant galaxy cluster MACS J1423.8+2404, astronomers have measured the effects of dark energy—a mysterious force causing the universe to expand faster and faster over time. By studying how galaxies in this cluster are drifting apart, scientists collect real-world evidence that dark energy acts like a kind of "anti-gravity," pushing the vast cosmic web ever outward and shaping the fate of everything we see in the universe. ✨
#darkenergy⚡#galaxycluster⚡#expansion⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 In the Perseus Galaxy Cluster, astronomers have found that its galaxies move in ways that visible matter alone can't explain—pointing to huge amounts of dark matter, an invisible form of matter detected only by its gravity. Surprisingly, dark energy—an even more mysterious force—is also at work here, pushing galaxies apart and accelerating the universe’s expansion, making Perseus a real example of how both dark matter and dark energy shape the cosmos while remaining hidden from our eyes. ✨
#PerseusCluster⚡#darkmatter⚡#darkenergy⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The universe’s end might play out as a “Big Freeze,” where expansion driven by dark energy causes galaxies like the Milky Way and Andromeda to drift so far apart that even their light can never reach each other. In this frozen future, after stars such as Proxima Centauri and Betelgeuse have burned out, only black holes and fading remnants like white dwarfs and neutron stars would remain, with temperatures dropping close to absolute zero and the cosmos growing ever darker and quieter. ✨
#universeend⚡#darkenergy⚡#cosmology⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 In the Virgo constellation, astronomers study galaxy clusters like Virgo Cluster to understand the universe’s endgame, using real data to measure how the mysterious force called dark energy is speeding up cosmic expansion. If this expansion keeps accelerating, even giant galaxies such as Messier 87 will someday drift so far apart that their light can no longer reach each other, resulting in a cold, ever-darkening universe filled with isolated islands of stars. ✨
#VirgoCluster⚡#darkenergy⚡#Messier87⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels