Python 3.12 support in the Python driver

15 views
Skip to first unread message

Bret McGuire

unread,
Oct 21, 2024, 3:21:52 PM10/21/24
to DataStax Python Driver for Apache Cassandra User Mailing List
   Greetings all!  I wanted to throw this message out as a clarification around our current support for Python 3.12.  This came up in an internal Slack conversation but it seemed to have wider relevance.

   Python 3.12 removed the asyncore library that was the default event loop for the Python driver.  The intent was for asyncore to be replaced by asyncio but that lib has definitely experienced some growing pains; our asyncio event loop isn't recommended for production use as of the current release (3.29.2).  The upshot here is that the built-in event loops used by the driver aren't available with Python 3.12.

   Fortunately new versions of the Python driver have added support for the libev event loop to the wheels available from pypi.  The 3.29.1 release added this support for Linux and OSX wheels while the 3.29.2 release did the same for Windows wheels.  So as long as you're using those releases (or, more accurately, the wheels for those releases) you can use the libev event loop with Python 3.12.  This event loop should be as stable as the old asyncore event loop and is used in production settings by several of our clients.

   In order to use libev you will need to make sure the libev library itself is installed and accessible on your system and you'll have to change the connection class used by the driver when it's creating connections.  You can find additional information about both of these requirements in the libev section of the installation docs.

   Hopefully this clarifies the situation.  If you still have questions please reply here and we can talk about them.

   Thanks all!

  - Bret -

Reply all
Reply to author
Forward
0 new messages