Developer Installation Instructions

Note

This page is for developers who want to customize or extend OpenWISP Notifications, whether for bug fixes, new features, or contributions.

For user guides and general information, please see:

The following diagram illustrates the role of the Notifications module within the OpenWISP architecture.

OpenWISP Architecture: Notifications module

OpenWISP Architecture: highlighted notifications module

Important

For an enhanced viewing experience, open the image above in a new browser tab.

Refer to Architecture, Modules, Technologies for more information.

Installing for Development

Install the system dependencies:

sudo apt install sqlite3 libsqlite3-dev openssl libssl-dev

Fork the openwisp-notifications repository on GitHub, then clone your fork. Replace YOUR_GITHUB_USERNAME with your GitHub username:

git clone git@github.com:YOUR_GITHUB_USERNAME/openwisp-notifications.git

Navigate into the cloned repository:

cd openwisp-notifications/

Launch Redis:

docker compose up -d redis

Setup and activate a virtual-environment (we'll be using virtualenv):

python -m virtualenv env
source env/bin/activate

Make sure that your base python packages are up to date before moving to the next step:

pip install -U pip wheel setuptools

Install development dependencies:

pip install -e .
pip install -r requirements-test.txt
sudo npm install -g prettier

Create database:

cd tests/
./manage.py migrate
./manage.py createsuperuser

Launch celery worker (for background jobs):

celery -A openwisp2 worker -l info

Launch development server:

./manage.py runserver

You can access the admin interface at http://127.0.0.1:8000/admin/.

From the repository root, run tests with:

# Full CI coverage suite, including the sample app and websocket tests
./runtests

# Focus a Django test module
./runtests openwisp_notifications.tests.test_notifications

# Focus a websocket test
./runtests openwisp_notifications.tests.test_websockets.TestNotificationSockets.test_new_notification_created

# Exclude production-incompatible tests
./runtests --suite --exclude skip_prod

# Run the sample app tests
SAMPLE_APP=1 ./runtests --suite

The full suite also runs the sample app in /tests/openwisp2/ to test extensibility. For more information, read the following section.

Run quality assurance tests with:

./run-qa-checks

Alternative Sources

Pypi

To install the latest Pypi:

pip install openwisp-notifications

Github

To install the latest development version tarball via HTTPs:

pip install https://github.com/openwisp/openwisp-notifications/tarball/master

Alternatively you can install the latest development version from Git:

pip install -e git+https://github.com/openwisp/openwisp-notifications#egg=openwisp_notifications