Skip to content

Development_Contribution

Chris Caron edited this page Mar 4, 2019 · 22 revisions

Thanks to all who have landed on this page with the intent of contributing to the apprise library. Any changes you make are going to easily make it upstream as long as there is there are:

  • Unit tests: apprise is currently sitting at 100% test coverage. The goal is to keep it this way! 🙂
  • PEP8 Compliance: Following the PEP 8 Style Guide for Python is a must. Most editors have PEP8 plugins and allow you to keep everything compliant as you go.
  • Python 2.7 backwards support. I'd like to support Python 2.7 for as long as i can only because there is a huge amount of servers still using this today. When you push your code upstream, a code-runner will test all this for you if you're uncertain.

The following should get you all set up:

# Install our apprise development requirements
pip install --requirement requirements.txt --requirement dev-requirements.txt

I also have this small (very simple) script that I run each time before I push my changes. It may or may not be useful to others:

#!/bin/sh
# Description: This is a checkdone.sh script used to check against the
#              apprise project that I reference before I commit any code
#              upstream.
#
#              Note: this script was intended to be ran from within the
#                    apprise root directory (after being checked out from
#                    github).

cleanup() {
   # Simple safety checking (ensure we're in the right dir)
   [ ! -d "apprise" ] && return 1
   [ ! -d "apprise/plugins" ] && return 1
   [ ! -d "apprise/config" ] && return 1
   [ ! -d "test" ] && return 1

   # we can safely assume we're being ran at the root of the apprise
   # directory
   rm -rf .tox/ .eggs .coverage .cache \
      apprise.egg-info htmlcov build &>/dev/null
   find . -type d -name __pycache__ \
      -exec rm -rf {} \; &>/dev/null
   find . -maxdepth 1 -mindepth 1 -type f \
      -name '.coverage.*' -delete
   return 0
}

# Incase it wasn't ran before (or we ctrl-c'ed last time)
cleanup

flake8 . --show-source --statistics && \
   flake8-3 . --show-source --statistics
if [ $? -ne 0 ]; then
   echo "pep8 failed; early exit."
   exit 1
fi

coverage run --parallel -m pytest -vv && \
   coverage3 run --parallel -m pytest -vv
if [ $? -ne 0 ]; then
   echo "tests failed; early exit."
   exit 1
fi

coverage combine
coverage report --show-missing

# Cleanup
cleanup
Clone this wiki locally