From 56e0aa75a7d4d2bad40d84d3b2d9f4f9c2e08a72 Mon Sep 17 00:00:00 2001 From: Kubudak90 Date: Sun, 5 Apr 2026 13:22:52 +0300 Subject: [PATCH] fix(python): remove nest_asyncio dependency for Python 3.12+ compatibility Remove nest_asyncio which is unmaintained and incompatible with Python 3.12+'s loop_factory parameter. This fixes compatibility issues with modern uvicorn and other async libraries that use loop_factory. Fixes #591 --- python/cdp/evm_local_account.py | 12 ------------ python/pyproject.toml | 1 - 2 files changed, 13 deletions(-) diff --git a/python/cdp/evm_local_account.py b/python/cdp/evm_local_account.py index 2c1cb0d0d..af70cd703 100644 --- a/python/cdp/evm_local_account.py +++ b/python/cdp/evm_local_account.py @@ -1,7 +1,6 @@ import asyncio from typing import Any -import nest_asyncio from eth_account.datastructures import SignedMessage, SignedTransaction from eth_account.messages import SignableMessage, _hash_eip191_message, encode_typed_data from eth_account.signers.base import BaseAccount @@ -11,17 +10,6 @@ from cdp.errors import UserInputValidationError from cdp.evm_server_account import EvmServerAccount -# Apply nest-asyncio to allow nested event loops, but only if compatible -try: - nest_asyncio.apply() -except ValueError as e: - # If nest_asyncio can't patch the loop (e.g., uvloop), silently continue - # This commonly happens when uvloop is installed and running - if "Can't patch loop" in str(e): - pass - else: - # Re-raise other ValueError exceptions - raise def _run_async(coroutine): diff --git a/python/pyproject.toml b/python/pyproject.toml index 50882105b..cbca6e237 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -17,7 +17,6 @@ dependencies = [ "web3>=7.6.0,<=7.10.0", "solana>=0.36.6", "solders>=0.26.0", - "nest-asyncio>=1.6.0,<2", "base58>=2.1.1", ]