@@ -149,6 +149,13 @@ def _try_libev_import():
149149 except DependencyException as e :
150150 return (None , e )
151151
152+ def _try_asyncio_import ():
153+ try :
154+ from cassandra .io .asyncioreactor import AsyncioConnection
155+ return (AsyncioConnection , None )
156+ except (ImportError , DependencyException ) as e :
157+ return (None , e )
158+
152159def _try_asyncore_import ():
153160 try :
154161 from cassandra .io .asyncorereactor import AsyncoreConnection
@@ -168,7 +175,7 @@ def _connection_reduce_fn(val,import_fn):
168175
169176log = logging .getLogger (__name__ )
170177
171- conn_fns = (_try_gevent_import , _try_eventlet_import , _try_libev_import , _try_asyncore_import )
178+ conn_fns = (_try_gevent_import , _try_eventlet_import , _try_libev_import , _try_asyncio_import , _try_asyncore_import )
172179(conn_class , excs ) = reduce (_connection_reduce_fn , conn_fns , (None ,[]))
173180if not conn_class :
174181 raise DependencyException ("Unable to load a default connection class" , excs )
@@ -876,25 +883,21 @@ def default_retry_policy(self, policy):
876883 This determines what event loop system will be used for managing
877884 I/O with Cassandra. These are the current options:
878885
879- * :class:`cassandra.io.asyncorereactor.AsyncoreConnection`
880886 * :class:`cassandra.io.libevreactor.LibevConnection`
887+ * :class:`cassandra.io.asyncioreactor.AsyncioConnection`
888+ * :class:`cassandra.io.asyncorereactor.AsyncoreConnection` (Python < 3.12 only)
881889 * :class:`cassandra.io.eventletreactor.EventletConnection` (requires monkey-patching - see doc for details)
882890 * :class:`cassandra.io.geventreactor.GeventConnection` (requires monkey-patching - see doc for details)
883891 * :class:`cassandra.io.twistedreactor.TwistedConnection`
884- * EXPERIMENTAL: :class:`cassandra.io.asyncioreactor.AsyncioConnection`
885-
886- By default, ``AsyncoreConnection`` will be used, which uses
887- the ``asyncore`` module in the Python standard library.
888-
889- If ``libev`` is installed, ``LibevConnection`` will be used instead.
890892
891- If ``gevent`` or ``eventlet`` monkey-patching is detected, the corresponding
892- connection class will be used automatically.
893+ The default is selected automatically using the following priority:
893894
894- ``AsyncioConnection``, which uses the ``asyncio`` module in the Python
895- standard library, is also available, but currently experimental. Note that
896- it requires ``asyncio`` features that were only introduced in the 3.4 line
897- in 3.4.6, and in the 3.5 line in 3.5.1.
895+ 1. If ``gevent`` or ``eventlet`` monkey-patching is detected, the
896+ corresponding connection class will be used.
897+ 2. If the ``libev`` C extension is available, ``LibevConnection`` is used.
898+ 3. ``AsyncioConnection`` is used as the standard-library fallback. This is
899+ the preferred default on Python 3.12+ where ``asyncore`` was removed.
900+ 4. On Python < 3.12, ``AsyncoreConnection`` is used as a last resort.
898901 """
899902
900903 control_connection_timeout = 2.0
0 commit comments