cassandra/pylib
Mick Semb Wever 3c66c74a0f
Merge branch 'cassandra-3.11' into cassandra-4.0
* cassandra-3.11:
  3.x cqlshlib tests broken on python2.7
2025-12-19 23:34:52 +01:00
..
cqlshlib Fix autocompletion for role names/user names 2025-02-04 10:44:12 +01:00
Dockerfile.ubuntu.py2 Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
Dockerfile.ubuntu.py3 Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
Dockerfile.ubuntu.py37 Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
Dockerfile.ubuntu.py38 Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
README.asc Allow cqlsh to run with Python 2.7/Python 3.6+ 2020-04-14 20:58:40 +02:00
cassandra-cqlsh-tests.sh Merge branch 'cassandra-3.0' into cassandra-3.11 2025-12-19 23:34:02 +01:00
pytest.ini Merge branch 'cassandra-3.11' into cassandra-4.0 2023-08-31 22:39:56 +02:00
requirements.txt Merge branch 'cassandra-3.11' into cassandra-4.0 2025-12-19 23:34:52 +01:00
setup.py Make cython optional in pylib/setup.py 2016-04-27 08:42:32 +08:00

README.asc

== Overview

This directory contains code primarily for cqlsh. cqlsh uses cqlshlib in this directory.
Currently, cqlshlib supports Python 2 as well as Python 3. Support for Python 3 is relatively
new.

== Requirements
. Python 3 and 2.7 (for cqlsh)
. virtualenv
. Docker (optional)

== Running tests

In order to run tests for cqlshlib, run cassandra-cqlsh-tests.sh in this directory. It will
automatically setup a virtualenv with the appropriate version of Python and run tests inside it.

There are Dockerfiles that can be used to test whether cqlsh works with a default, barebones
Python installation. Assuming Cassandra's source is checked out at `$CASSANDRA_DIR`. To test, first
build the Docker image containing the barebones Python installation -

  $ docker build . --file Dockerfile.ubuntu.py3 -t ubuntu-lts-py3

Next, run cqlsh inside the newly built image -

  $ docker run -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh host.docker.internal

If `host.docker.internal` isn't supported, then you can use `--net="host"` with `docker run`:

  $ docker run --net="host" -v $CASSANDRA_DIR:/code -it ubuntu-lts-py3:latest /code/bin/cqlsh

This will try to spawn a cqlsh instance inside the Docker container running Ubuntu LTS (18.04)
with minimal Python installation. It will try to connect to the Cassandra instance running on the
Docker host at port 9042. If you have Cassandra running elsewhere, replace host.docker.internal
with the IP / hostname as usual. Please ensure that the IP / host is accessible from _within_ the
Docker container.