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
Copy file name to clipboardExpand all lines: CONTRIBUTING.rst
+25-16Lines changed: 25 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -29,25 +29,36 @@ Here's how to get started with your code contribution:
29
29
30
30
1. Create your own fork of redis-py
31
31
2. Do the changes in your fork
32
-
3. If you need a development environment, run ``make dev``
33
-
4. While developing, make sure the tests pass by running ``make test``
32
+
3. Create a virtualenv and install the development dependencies from the dev_requirements.txt file:
33
+
a. python -m venv .venv
34
+
b. source .venv/bin/activate
35
+
c. pip install -r dev_requirements.txt
36
+
3. If you need a development environment, run ``invoke devenv``
37
+
4. While developing, make sure the tests pass by running ``invoke tests``
34
38
5. If you like the change and think the project could use it, send a pull request
35
39
40
+
To see what else is part of the automation, run ``invoke -l``
41
+
36
42
The Development Environment
37
43
---------------------------
38
44
39
-
Running ``make dev`` will create a Docker-based development environment that starts the following containers:
45
+
Running ``invoke devenv`` installs the development dependencies specified in the dev_requirements.txt. It starts all of the dockers used by this project, and leaves them running. These can be easily cleaned up with ``invoke clean``. NOTE: it is assumed that the user running these tests, can execute docker and its various commands.
40
46
41
47
* A master Redis node
42
-
* A slave Redis node
48
+
* A Redis replica node
43
49
* Three sentinel Redis nodes
44
-
* A test container
50
+
* A multi-python docker, with your source code mounted in /data
45
51
46
-
The slave is a replica of the master node, using the `leader-follower replication <https://redis.io/topics/replication>`_ feature.
52
+
The replica node, is a replica of the master node, using the `leader-follower replication <https://redis.io/topics/replication>`_ feature.
47
53
48
54
The sentinels monitor the master node in a `sentinel high-availability configuration <https://redis.io/topics/sentinel>`_.
49
55
50
-
Meanwhile, the `test` container hosts the code from your checkout of ``redis-py`` and allows running tests against many Python versions.
56
+
Testing
57
+
-------
58
+
59
+
Each run of tox starts and stops the various dockers required. Sometimes things get stuck, an ``invoke clean`` can help.
60
+
61
+
Continuous Integration uses these same wrappers to run all of these tests against multiple versions of python. Feel free to test your changes against all the python versions supported, as declared by the tox.ini file (eg: tox -e py39). If you have the various python versions on your desktop, you can run *tox* by itself, to test all supported versions. Alternatively, as your source code is mounted in the **lots-of-pythons** docker, you can start exploring from there, with all supported python versions!
51
62
52
63
Docker Tips
53
64
^^^^^^^^^^^
@@ -56,17 +67,17 @@ Following are a few tips that can help you work with the Docker-based developmen
56
67
57
68
To get a bash shell inside of a container:
58
69
59
-
``$ docker-compose run <service> /bin/bash``
60
-
61
-
**Note**: The term "service" refers to the "services" defined in the ``docker-compose.yml`` file: "master", "slave", "sentinel_1", "sentinel_2", "sentinel_3", "test".
70
+
``$ docker run -it <service> /bin/bash``
71
+
72
+
**Note**: The term "service" refers to the "services" defined in the ``tox.ini`` file at the top of the repo: "master", "replicaof", "sentinel_1", "sentinel_2", "sentinel_3".
62
73
63
74
Containers run a minimal Debian image that probably lacks tools you want to use. To install packages, first get a bash session (see previous tip) and then run:
64
75
65
76
``$ apt update && apt install <package>``
66
77
67
-
You can see the combined logging output of all containers like this:
78
+
You can see the logging output of a containers like this:
68
79
69
-
``$ docker-compose logs``
80
+
``$ docker logs -f <service>``
70
81
71
82
The command `make test` runs all tests in all tested Python environments. To run the tests in a single environment, like Python 3.6, use a command like this:
72
83
@@ -81,13 +92,11 @@ Our test suite uses ``pytest``. You can run a specific test suite against a spec
81
92
Troubleshooting
82
93
^^^^^^^^^^^^^^^
83
94
If you get any errors when running ``make dev`` or ``make test``, make sure that you
84
-
are using supported versions of Docker and docker-compose.
95
+
are using supported versions of Docker.
85
96
86
-
The included Dockerfiles and docker-compose.yml file work with the following
0 commit comments