Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/docs-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
python-version: '3.10'
- name: Set up env
run: make -C docs setupenv
- name: Build driver
run: python setup.py develop
- name: Build docs
run: make -C docs multiversion
- name: Build redirects
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/docs-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ jobs:
python-version: '3.10'
- name: Set up env
run: make -C docs setupenv
- name: Build driver
run: python setup.py develop
- name: Build docs
run: make -C docs test
28 changes: 19 additions & 9 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,30 @@ jobs:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'

- uses: actions/setup-python@v5
name: Install Python ${{ matrix.python-version }}
- name: Install libev
run: sudo apt-get install libev4 libev-dev

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Test with pytest
# This is to get honest accounting of test time vs download time vs build time.
# Not strictly necessary for running tests.
- name: Build driver
run: uv sync

# This is to get honest accounting of test time vs download time vs build time.
# Not strictly necessary for running tests.
- name: Download Scylla
run: |
export EVENT_LOOP_MANAGER=${{ matrix.event_loop_manager }}
export SCYLLA_VERSION='release:6.2'
./scripts/run_integration_test.sh tests/integration/standard/ tests/integration/cqlengine/

- name: Test tablets
uv run ccm create scylla-driver-temp -n 1 --scylla --version ${SCYLLA_VERSION}
uv run ccm remove

- name: Test with pytest
run: |
export EVENT_LOOP_MANAGER=${{ matrix.event_loop_manager }}
export SCYLLA_VERSION='release:6.2'
./scripts/run_integration_test.sh tests/integration/experiments/
export PROTOCOL_VERSION=4
uv run pytest tests/integration/standard/ tests/integration/cqlengine/
28 changes: 11 additions & 17 deletions .github/workflows/lib-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,14 @@ jobs:
echo "CIBW_BEFORE_TEST=true" >> $GITHUB_ENV;
echo "CIBW_BEFORE_TEST_WINDOWS=(exit 0)" >> $GITHUB_ENV;

- uses: actions/setup-python@v5
name: Install Python
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ inputs.python-version }}
allow-prereleases: 'true'

- name: Enable pip installing globally
if: runner.os == 'MacOs' || runner.os == 'Windows'
run: |
echo "PIP_BREAK_SYSTEM_PACKAGES=1" >> $GITHUB_ENV

- name: Install cibuildwheel
run: |
python3 -m pip install cibuildwheel==2.22.0
uv tool install 'cibuildwheel==2.22.0'

- name: Install OpenSSL for Windows
if: runner.os == 'Windows'
Expand Down Expand Up @@ -154,12 +148,12 @@ jobs:
if: matrix.target != 'linux-aarch64'
shell: bash
run: |
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" python3 -m cibuildwheel --output-dir wheelhouse
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" cibuildwheel --output-dir wheelhouse

- name: Build wheels for linux aarch64
if: matrix.target == 'linux-aarch64'
run: |
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" CIBW_BUILD="cp3*" python -m cibuildwheel --archs aarch64 --output-dir wheelhouse
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" CIBW_BUILD="cp3*" cibuildwheel --archs aarch64 --output-dir wheelhouse

- uses: actions/upload-artifact@v4
with:
Expand All @@ -172,14 +166,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ inputs.python-version }}

- name: Build sdist
run: |
pip install build
python -m build --sdist

run: uv build --sdist

- uses: actions/upload-artifact@v4
with:
name: source-dist
Expand Down
39 changes: 23 additions & 16 deletions README-dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Releasing
Building the Docs
=================

To build and preview the documentation for the ScyllaDB Python driver locally, you must first manually install `python-driver`.
To build and preview the documentation for the ScyllaDB Python driver locally, you must first manually install `python-driver`.
This is necessary for autogenerating the reference documentation of the driver.
You can find detailed instructions on how to install the driver in the `Installation guide <https://python-driver.docs.scylladb.com/stable/installation.html#manual-installation>`_.

Expand All @@ -24,20 +24,28 @@ After installing the driver, you can build the documentation:
- Install poetry: ``pip install poetry``
- To preview docs in your browser: ``make -C docs preview``

Tooling
=======

We recommend using `uv` tool for running tests, linters and basically everything else,
since it makes Python tooling ecosystem mostly usable.
To install it, see instructions at https://docs.astral.sh/uv/getting-started/installation/
The rest of this document assumes you have `uv` installed.

Tests
=====

Running Unit Tests
------------------
Unit tests can be run like so::

python -m pytest tests/unit
EVENT_LOOP_MANAGER=gevent python -m pytest tests/unit/io/test_geventreactor.py
EVENT_LOOP_MANAGER=eventlet python -m pytest tests/unit/io/test_eventletreactor.py
uv run pytest tests/unit
EVENT_LOOP_MANAGER=gevent uv run pytest tests/unit/io/test_geventreactor.py
EVENT_LOOP_MANAGER=eventlet uv run pytest tests/unit/io/test_eventletreactor.py

You can run a specific test method like so::

python -m pytest tests/unit/test_connection.py::ConnectionTest::test_bad_protocol_version
uv run pytest tests/unit/test_connection.py::ConnectionTest::test_bad_protocol_version

Running Integration Tests
-------------------------
Expand All @@ -46,17 +54,17 @@ In order to run integration tests, you must specify a version to run using eithe
* ``CASSANDRA_VERSION``
environment variable::

SCYLLA_VERSION="release:5.1" python -m pytest tests/integration/standard tests/integration/cqlengine/
SCYLLA_VERSION="release:5.1" uv run pytest tests/integration/standard tests/integration/cqlengine/

Or you can specify a scylla/cassandra directory (to test unreleased versions)::

SCYLLA_VERSION=/path/to/scylla pytest tests/integration/standard/
SCYLLA_VERSION=/path/to/scylla uv run pytest tests/integration/standard/

Specifying the usage of an already running Scylla cluster
------------------------------------------------------------
The test will start the appropriate Scylla clusters when necessary but if you don't want this to happen because a Scylla cluster is already running the flag ``USE_CASS_EXTERNAL`` can be used, for example::

USE_CASS_EXTERNAL=1 SCYLLA_VERSION='release:5.1' pytest tests/integration/standard
USE_CASS_EXTERNAL=1 SCYLLA_VERSION='release:5.1' uv run pytest tests/integration/standard

Specify a Protocol Version for Tests
------------------------------------
Expand All @@ -66,30 +74,29 @@ The protocol version defaults to:
- 5 for Cassandra >= 4.0, 4 for Cassandra >= 2.2, 3 for Cassandra >= 2.1, 2 for Cassandra >= 2.0
You can overwrite it with the ``PROTOCOL_VERSION`` environment variable::

PROTOCOL_VERSION=3 SCYLLA_VERSION="release:5.1" python -m pytest tests/integration/standard tests/integration/cqlengine/
PROTOCOL_VERSION=3 SCYLLA_VERSION="release:5.1" uv run pytest tests/integration/standard tests/integration/cqlengine/

Seeing Test Logs in Real Time
-----------------------------
Sometimes it's useful to output logs for the tests as they run::

python -m pytest -s tests/unit/
uv run pytest -s tests/unit/

Use tee to capture logs and see them on your terminal::

python -m pytest -s tests/unit/ 2>&1 | tee test.log
uv run pytest -s tests/unit/ 2>&1 | tee test.log


Running the Benchmarks
======================
There needs to be a version of cassandra running locally so before running the benchmarks, if ccm is installed:
ccm create benchmark_cluster -v 3.0.1 -n 1 -s

uv run ccm create benchmark_cluster -v 3.0.1 -n 1 -s

To run the benchmarks, pick one of the files under the ``benchmarks/`` dir and run it::

python benchmarks/future_batches.py
uv run benchmarks/future_batches.py

There are a few options. Use ``--help`` to see them all::

python benchmarks/future_batches.py --help

uv run benchmarks/future_batches.py --help
3 changes: 3 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ threads used to build the driver and any C extensions:
$ # installing from pip
$ CASS_DRIVER_BUILD_CONCURRENCY=8 pip install scylla-driver

Note that by default (when CASS_DRIVER_BUILD_CONCURRENCY is not specified), concurrency will be equal to the number of
logical cores on your machine.

OSX Installation Error
^^^^^^^^^^^^^^^^^^^^^^
If you're installing on OSX and have XCode 5.1 installed, you may see an error like this::
Expand Down
37 changes: 29 additions & 8 deletions docs/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ package-mode = false
[tool.poetry.dependencies]
eventlet = "^0.33.3"
futures = "2.2.0"
geomet = ">=0.1,<0.3"
gevent = "^23.9.1"
gremlinpython = "3.4.7"
python = "^3.10"
pygments = "^2.18.0"
recommonmark = "0.7.1"
redirects_cli ="~0.1.2"
redirects_cli = "~0.1.2"
sphinx-autobuild = "^2024.4.19"
sphinx-sitemap = "^2.6.0"
sphinx-scylladb-theme = "^1.8.1"
Expand All @@ -23,6 +22,8 @@ Sphinx = "^7.3.7"
scales = "^1.0.9"
six = ">=1.9"
tornado = ">=4.0,<5.0"
scylla-driver = { path = "../", develop = true }


[build-system]
requires = ["poetry>=1.8.0"]
Expand Down
Loading
Loading