Skip to content

CASSANDRA-20997: Support Python 3.12 and 3.13 in cqlsh (5.0)#4666

Open
arvindKandpal-ksolves wants to merge 1 commit intoapache:cassandra-5.0from
arvindKandpal-ksolves:CASSANDRA-20997-5.0
Open

CASSANDRA-20997: Support Python 3.12 and 3.13 in cqlsh (5.0)#4666
arvindKandpal-ksolves wants to merge 1 commit intoapache:cassandra-5.0from
arvindKandpal-ksolves:CASSANDRA-20997-5.0

Conversation

@arvindKandpal-ksolves
Copy link
Contributor

Support Python 3.12 and 3.13 in cqlsh by vendoring the pyasyncore package.

Context / Background

Currently, starting cqlsh with Python 3.12 or 3.13 fails. Even if the version guards are relaxed, it crashes with a DependencyException because Python 3.12 removed the asyncore module from the standard library (PEP 594). The bundled Datastax python driver (cassandra-driver-internal-only) relies on asyncore as a default fallback event loop when C-extensions (libev) are not present, causing it to crash at import time.

Changes Made

To fix this without modifying the bundled third-party driver's internal code:

  1. Dependency Management: Updated .build/build-resolver.xml to fetch the official pyasyncore package from PyPI and package it as a .zip in the lib/ directory.
  2. Path Injection: Added 'pyasyncore-' to the third_parties tuple in bin/cqlsh.py so it gets injected into sys.path at runtime (matching the existing approach for wcwidth and pure_sasl).
  3. Version Guards: Relaxed the supported version checks in both bin/cqlsh and bin/cqlsh.py to allow Python up to 3.13.

Testing

  • Successfully ran ant cqlsh to verify that pyasyncore-1.0.5-py3-none-any.zip is downloaded and copied to the lib/ directory.
  • Tested cqlsh locally with CQLSH_PYTHON=python3.12 and CQLSH_PYTHON=python3.13 to confirm it successfully connects to the cluster without throwing driver import errors.
  • Confirmed that Python 3.14 correctly triggers the "unsupported version" warning message.

patch by Arvind Kandpal; for CASSANDRA-20997 and CASSANDRA-19206

@michaelsembwever
Copy link
Member

michaelsembwever commented Mar 25, 2026

@arvindKandpal-ksolves , please cherry-pick (and squash) in thelastpickle@6117ca5

@arvindKandpal-ksolves
Copy link
Contributor Author

arvindKandpal-ksolves commented Mar 26, 2026

@michaelsembwever I have cherry-picked and squashed the commit 6117ca5 into this PR. Please let me know if anything else is needed!

@michaelsembwever
Copy link
Member

thanks. the images for the dockerfile is now on dockerhub and jfrog for further testing. (only while it's md5sum is 25838a563a4b660d7423dd9d1d6e7191)

Copy link
Member

@michaelsembwever michaelsembwever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending CI

@arvindKandpal-ksolves
Copy link
Contributor Author

just need to confirm that I have patch for trunk branch too, I need to cherry pick on that branch to ??

@michaelsembwever
Copy link
Member

need to cherry pick on that branch to ??

yes, but note the file rename has already happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants