You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Split README-dec into CONTRIBUTING and MAINTENANCE
It was quite weird to have both CONTRIBUTING and README-dev.
Most of README-dev fits well into CONTRIBUTING. The sections about
releasing deserves its own MAINTENANCE document, similarly to how it is
done in Rust Driver.
* CONTRIBUTING: Adjust commands to Scylla
Gets rid of some Cassandra leftovers, and updates some mentioned Scylla
versions.
* CONTRIBUTING: Recommend ccache/sccache
Those tools dramatically speed up building of the driver, making
contributor life much easier.
Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+95-1Lines changed: 95 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,105 @@ good bug reports. They will not be repeated in detail here, but in general, the
18
18
Pull Requests
19
19
-------------
20
20
If you're able to fix a bug yourself, you can `fork the repository <https://help.github.com/articles/fork-a-repo/>`_ and submit a `Pull Request <https://help.github.com/articles/using-pull-requests/>`_ with the fix.
21
-
Please include tests demonstrating the issue and fix. For examples of how to run the tests, consult the `dev README <https://github.com/scylladb/python-driver/blob/master/README-dev.rst#running-the-tests>`_.
21
+
Please include tests demonstrating the issue and fix. For examples of how to run the tests, consult the further parts of this document.
22
22
23
23
Design and Implementation Guidelines
24
24
------------------------------------
25
25
- We have integrations (notably Cassandra cqlsh) that require pure Python and minimal external dependencies. We try to avoid new external dependencies. Where compiled extensions are concerned, there should always be a pure Python fallback implementation.
26
26
- This project follows `semantic versioning <http://semver.org/>`_, so breaking API changes will only be introduced in major versions.
27
27
- Legacy ``cqlengine`` has varying degrees of overreaching client-side validation. Going forward, we will avoid client validation where server feedback is adequate and not overly expensive.
28
28
- When writing tests, try to achieve maximal coverage in unit tests (where it is faster to run across many runtimes). Integration tests are good for things where we need to test server interaction, or where it is important to test across different server versions (emulating in unit tests would not be effective).
29
+
30
+
Dev setup
31
+
=========
32
+
33
+
We recommend using `uv` tool for running tests, linters and basically everything else,
34
+
since it makes Python tooling ecosystem mostly usable.
35
+
To install it, see instructions at https://docs.astral.sh/uv/getting-started/installation/
36
+
The rest of this document assumes you have `uv` installed.
37
+
38
+
It is also strongly recommended to use C/C++-caching tool like ccache or sccache.
39
+
When modifying driver files, rebuilding Cython modules is often necessary.
40
+
Without caching, each such rebuild may take over a minute. Caching usually brings it
41
+
down to about 2-3 seconds.
42
+
43
+
Building the Docs
44
+
=================
45
+
46
+
To build and preview the documentation for the ScyllaDB Python driver locally, you must first manually install `python-driver`.
47
+
This is necessary for autogenerating the reference documentation of the driver.
48
+
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>`_.
49
+
50
+
After installing the driver, you can build the documentation:
51
+
- Make sure you have Python version compatible with docs. You can see supported version in ``docs/pyproject.toml`` - look for ``python`` in ``tool.poetry.dependencies`` section.
52
+
- Install poetry: ``pip install poetry``
53
+
- To preview docs in your browser: ``make -C docs preview``
54
+
55
+
Tests
56
+
=====
57
+
58
+
Running Unit Tests
59
+
------------------
60
+
Unit tests can be run like so::
61
+
62
+
uv run pytest tests/unit
63
+
EVENT_LOOP_MANAGER=gevent uv run pytest tests/unit/io/test_geventreactor.py
64
+
EVENT_LOOP_MANAGER=eventlet uv run pytest tests/unit/io/test_eventletreactor.py
65
+
66
+
You can run a specific test method like so::
67
+
68
+
uv run pytest tests/unit/test_connection.py::ConnectionTest::test_bad_protocol_version
69
+
70
+
Running Integration Tests
71
+
-------------------------
72
+
In order to run integration tests, you must specify a version to run using either of:
73
+
* ``SCYLLA_VERSION`` e.g. ``release:2025.2``
74
+
* ``CASSANDRA_VERSION``
75
+
environment variable::
76
+
77
+
SCYLLA_VERSION="release:2025.2" uv run pytest tests/integration/standard tests/integration/cqlengine/
78
+
79
+
Or you can specify a scylla/cassandra directory (to test unreleased versions)::
80
+
81
+
SCYLLA_VERSION=/path/to/scylla uv run pytest tests/integration/standard/
82
+
83
+
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::
86
+
87
+
USE_CASS_EXTERNAL=1 SCYLLA_VERSION='release:5.1' uv run pytest tests/integration/standard
88
+
89
+
Specify a Protocol Version for Tests
90
+
------------------------------------
91
+
The protocol version defaults to:
92
+
- 4 for Scylla >= 3.0 and Scylla Enterprise > 2019.
93
+
- 3 for older versions of Scylla
94
+
- 5 for Cassandra >= 4.0, 4 for Cassandra >= 2.2, 3 for Cassandra >= 2.1, 2 for Cassandra >= 2.0
95
+
You can overwrite it with the ``PROTOCOL_VERSION`` environment variable::
96
+
97
+
PROTOCOL_VERSION=3 SCYLLA_VERSION="release:5.1" uv run pytest tests/integration/standard tests/integration/cqlengine/
98
+
99
+
Seeing Test Logs in Real Time
100
+
-----------------------------
101
+
Sometimes it's useful to output logs for the tests as they run::
102
+
103
+
uv run pytest -s tests/unit/
104
+
105
+
Use tee to capture logs and see them on your terminal::
106
+
107
+
uv run pytest -s tests/unit/ 2>&1 | tee test.log
108
+
109
+
110
+
Running the Benchmarks
111
+
======================
112
+
There needs to be a version of Scyll running locally so before running the benchmarks, if ccm is installed:
* Add the new version in ``docs/conf.py`` (variables: ``TAGS``, ``LATEST_VERSION``, ``DEPRECATED_VERSIONS``).
6
+
* For patch version releases (like ``3.26.8-scylla -> 3.26.9-scylla``) replace the old version with new one in ``TAGS`` and update ``LATEST_VERSION``.
7
+
* For minor version releases (like ``3.26.9-scylla -> 3.27.0-scylla``) add new version to ``TAGS``, update ``LATEST_VERSION`` and add previous minor version to ``DEPRECATED_VERSIONS``.
8
+
* Commit the version changes, e.g. ``git commit -m 'Release 3.26.9'``
9
+
* Tag the release. For example: ``git tag -a 3.26.9-scylla -m 'Release 3.26.9'``
10
+
* Push the tag and new ``master`` SIMULTANEOUSLY: ``git push --atomic origin master v6.0.21-scylla``
11
+
* Now new version and its docs should be automatically published. Check `PyPI <https://pypi.org/project/scylla-driver/#history>`_ and `docs <https://python-driver.docs.scylladb.com/stable/>`_ to make sure its there.
12
+
* If you didn't push branch and tag simultaneously (or doc publishing failed for other reason) then restart the relevant job from GitHub Actions UI.
13
+
* Publish a GitHub Release and a post on community forum.
0 commit comments