Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to migrate your Eventlet projects to Asyncio

Eventlet is dead; long live Asyncio!

October 2, 2024
Herve Beraud
Related topics:
Event-DrivenProgramming languages & frameworksPython
Related products:
Red Hat OpenShift

Share:

    After decades of long and loyal service, the famous Python library Eventlet is on the way to being officially retired. Eventlet suffered from several years of scarce maintenance and is now a broken and outdated technology. Eventlet users are encouraged to migrate off of Eventlet.

    A bit of history

    For almost 20 years, the Eventlet library was a mainstream library of the Python ecosystem. Eventlet has been downloaded almost 80 millions of times. It became famous for its asynchronous features. Eventlet allowed the usage of non-blocking network I/O at a time where async features were absent from CPython. This library is also famous for its usage of the Python monkey patching which allowed to its users to transform existing synchronous code into asynchronous code without to having to rewrite everything.

    The lack of active maintenance of Eventlet increased the gap between this library and the recent versions of Python. Eventlet reached a point where this gap is not recoverable.

    In a final effort, a couple of volunteers (I'm one of them) decided to transplant a new heart to Eventlet. This new heart is based on Asyncio. Our goal was to allow the Python community to migrate their Eventlet usages to Asyncio. Before that, both technologies were not compatible. Our goal was to open an escape door for all the people depending on Eventlet.

    Asyncio was selected as an official and by default alternative to Eventlet for two reasons: Asyncio is a modern implementation of non-blocking behaviors for CPython, and Asyncio is included in the CPython stdlib.

    Eventlet is now deprecated and migrations are heavily encouraged. Every Eventlet user should follow the migration guide. Only security fixes and bug fixes patches will be accepted during the coming year. Chances are high that Eventlet will be fully retired by the end of 2025.

    How can I start my migration?

    Often, projects based on Eventlet were created several years ago. Code bases may have grown big, and for this reason we wanted to allow incremental migrations. So we created a new Eventlet hub named asyncio that you can activate to start the migration.

    To do so, set export EVENTLET_HUB=asyncio or specify the asyncio hub at startup by calling:

    import eventlet.hubs
    eventlet.hubs.use_hub("eventlet.hubs.asyncio")

    From there, you can start to migrate your code to Asyncio by following the migration process. Take a look at our migration guide for more details.

    Migrating complex projects with Awaitlet

    Asyncio might be an invasive technology. When Asyncio is used, all the code base needs to become adapted to the async paradigm, which could be an issue for large code bases. For these projects, migrating to Asyncio would mean almost a complete rewrite of the code base. For this reason, we created the Awaitlet project. Awaitlet allows you to mix synchronous and asynchronous code without to have to rewrite all your code base.

    Awaitlet is born into SQLAlchemy. Originally Awaitlet was a pattern that allowed to modernize SQLAlchemy. This pattern allowed SQLAlchemy to became compatible with Asyncio and was extracted as an independent deliverable (Awaitlet) by my teammate Mike Bayer, who is also the creator of SQLAlchemy.

    More details about using Awaitlet can be found in the official documentation.

    Conclusion

    Eventlet is an outdated technology. If your project relies on Eventlet, then do not lose time and start your migration as soon as possible with the help of our migration guide. We heavily encourage adopting Asyncio, but sometimes people need an intermediate solution; that's why we created Awaitlet.

    Don't hesitate to share your experience with us. All feedback is greatly appreciated and each feedback will benefit to the whole community. You can open a new issue to discuss about your use cases.

    Thanks for reading.

    Related Posts

    • Why you should use io_uring for network I/O

    • Design event-driven integrations with Kamelets and Camel K

    • Virtualized database I/O performance improvements in RHEL 9.4

    • Event-driven business automation powered by cloud-native Java

    • Find and compare Python libraries with project2vec

    • Scaling virtio-blk disk I/O with IOThread Virtqueue Mapping

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    What’s up next?

    Explore how the migration toolkit for containers (MTC) paves the way for seamless migration of application workloads from ROSA classic to ROSA HCP clusters, right down to the namespace level in this learning path.

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue