Skip to content

Synapse for Developers

Aaron Raimist edited this page Dec 3, 2018 · 2 revisions

Synapse Development

Before setting up a development environment for synapse, make sure you have the system dependencies (such as the python header files) installed - see `Installing from source`_.

To check out a synapse for development, clone the git repo into a working directory of your choice:

git clone https://github.com/matrix-org/synapse.git
cd synapse

Synapse has a number of external dependencies, that are easiest to install using pip and a virtualenv:

virtualenv -p python2.7 env
source env/bin/activate
python -m synapse.python_dependencies | xargs pip install
pip install lxml mock

This will run a process of downloading and installing all the needed dependencies into a virtual env.

Once this is done, you may wish to run Synapse's unit tests, to check that everything is installed as it should be:

PYTHONPATH="." trial tests

This should end with a 'PASSED' result:

Ran 143 tests in 0.601s

PASSED (successes=143)

Running the Integration Tests

Synapse is accompanied by SyTest, a Matrix homeserver integration testing suite, which uses HTTP requests to access the API as a Matrix client would. It is able to run Synapse directly from the source tree, so installation of the server is not required.

Testing with SyTest is recommended for verifying that changes related to the Client-Server API are functioning correctly. See the installation instructions for details.

Running a Demo Federation of Synapses

If you want to get up and running quickly with a trio of homeservers in a private federation, there is a script in the demo directory. This is mainly useful just for development purposes. See demo/README.

Building Internal API Documentation

Before building internal API documentation install sphinx and sphinxcontrib-napoleon:

pip install sphinx
pip install sphinxcontrib-napoleon

Building internal API documentation:

python setup.py build_sphinx