| 1 |
============================ |
| 2 |
Contributing to IMAPClient |
| 3 |
============================ |
| 4 |
|
| 5 |
The best way to contribute changes to IMAPClient is to fork the |
| 6 |
official repository on Github, make changes in a branch in your |
| 7 |
personal fork and then submit a pull request. |
| 8 |
|
| 9 |
Discussion `on Github`_ before undertaking development is highly |
| 10 |
encouraged for potentially major changes. |
| 11 |
|
| 12 |
Although not essential, it will make the project maintainers much |
| 13 |
happier if change submissions include appropriate updates to unit |
| 14 |
tests, live tests and documentation. Please ask if you're unsure how |
| 15 |
of how the tests work. |
| 16 |
|
| 17 |
Please read on if you plan on submitting changes to IMAPClient. |
| 18 |
|
| 19 |
.. _`on Github`: https://github.com/mjs/imapclient/discussions |
| 20 |
|
| 21 |
Source Code |
| 22 |
=========== |
| 23 |
The official source code repository for IMAPClient can be found on |
| 24 |
Github at: https://github.com/mjs/imapclient |
| 25 |
|
| 26 |
Any major feature work will also be found as branches of this |
| 27 |
repository. |
| 28 |
|
| 29 |
Branches |
| 30 |
-------- |
| 31 |
Development for the next major release happens on the ``master`` branch. |
| 32 |
|
| 33 |
There is also a branch for each major release series (for example: |
| 34 |
``1.x``). When appropriate and when there will be future releases for |
| 35 |
a series, changes may be selectively merged between ``master`` and a |
| 36 |
stable release branch. |
| 37 |
|
| 38 |
Release Tags |
| 39 |
------------ |
| 40 |
Each released version is available in the IMAPClient repository |
| 41 |
as a Git tag (e.g. "0.9.1"). |
| 42 |
|
| 43 |
Unit Tests |
| 44 |
========== |
| 45 |
|
| 46 |
Running Unit Tests |
| 47 |
------------------ |
| 48 |
To run the tests, from the root of the package source run:: |
| 49 |
|
| 50 |
python -m unittest --verbose |
| 51 |
|
| 52 |
Testing Against Multiple Python Versions |
| 53 |
---------------------------------------- |
| 54 |
When submitting a Pull Request to IMAPClient, tests are automatically run |
| 55 |
against all the supported Python versions. |
| 56 |
|
| 57 |
It is possible to run these tests locally using `tox`_. Once |
| 58 |
installed, the ``tox`` command will use the tox.ini file in the root |
| 59 |
of the project source and run the unit tests against the Python |
| 60 |
versions officially supported by IMAPClient (provided these versions |
| 61 |
of Python are installed!). |
| 62 |
|
| 63 |
.. _`tox`: http://testrun.org/tox/ |
| 64 |
|
| 65 |
To avoid having to install all Python versions directly on a host, the |
| 66 |
``tox-all`` script can be used. It will run the unit tests inside a Docker |
| 67 |
container which contains all supported Python versions. As long as Docker is |
| 68 |
installed and your user account can sudo to root the following should work:: |
| 69 |
|
| 70 |
./tox-all |
| 71 |
|
| 72 |
The script passes any arguments on to tox. For example to run just the tests |
| 73 |
just against Python 3.10 do:: |
| 74 |
|
| 75 |
./tox-all -e py310 |
| 76 |
|
| 77 |
Writing Unit Tests |
| 78 |
------------------ |
| 79 |
Protocol level unit tests should not act against a real IMAP server |
| 80 |
but should use canned data instead. The IMAPClientTest base class |
| 81 |
should typically be used as the base class for any tests - it provides |
| 82 |
a mock IMAPClient instance at `self.client`. See the tests in |
| 83 |
`tests/test_imapclient.py` for examples of how to write unit tests using |
| 84 |
this approach. |
| 85 |
|
| 86 |
Documentation |
| 87 |
============= |
| 88 |
The source for the project's documentation can be found under doc/src |
| 89 |
in the source distribution. |
| 90 |
|
| 91 |
In order to build the documentation you'll need install |
| 92 |
Sphinx. Running ``pip install '.[doc]'`` from the root of the project |
| 93 |
source will do this. |
| 94 |
|
| 95 |
Once Sphinx is installed, the documentation can be rebuilt using:: |
| 96 |
|
| 97 |
python setup.py build_sphinx |