We’re always excited to welcome new volunteers to the RapidSMS project. As it keeps growing, we need more people to help others and contribute back to the community. As soon as you learn RapidSMS, you can contribute in many ways:
And, of course, you can help out by working on RapidSMS.
Follow PEP8 style conventions. Use 4 spaces instead of tabs.
Use CapitalizedCase for class names, underscored_words for method names.
Code using os.path must be Windows and ‘NIX friendly. For example, check for a file using os.path.join(‘foo’,’bar’) instead of ‘foo/bar’
Be sure every class and method has docstrings.
Add the following two lines to the beginning of your files to automatically configure many text editors (VI, Emacs) to do this automatically:
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
We highly recommend using virtualenv and virtualenvwrapper to work on RapidSMS core. These tools provide isolated Python environments, which are more practical than installing packages system wide. They also allow installing packages without administrator privileges. This section will outline the steps to setup RapidSMS core so that you can edit it while working on a RapidSMS project.
sudo pip install --upgrade virtualenv
sudo pip install --upgrade virtualenvwrapper
Then follow the virtualenvwrapper install docs to setup your shell properly.
mkvirtualenv --distribute rapidsms
cd <your-rapidsms-clone>
python setup.py develop
workon rapidsms
Now any changes made to your local RapidSMS clone will be reflected immediately while editing your project.
If you want to log in your app, just:
import logging
logger = logging.getLogger(__name__)
and use:
logger.debug("msg")
logger.critical("msg")
logger.exception("msg")
# etc.
All RapidSMS core logging can now be captured using the 'rapidsms' root logger. (There’s not a lot of logging from the core yet, but pull requests are welcome.)
For example, if you wanted messages from the RapidSMS core to be written to a file “/path/rapidsms.log”, you could define a new handler in the LOGGING setting in Django:
LOGGING = {
...
'handlers': {
...
'rapidsms_file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/rapidsms.log',
},
...
},
...
}
Setting level to DEBUG means all messages of level DEBUG and lower will be passed through (that’s all of them). Then this handler will write those messages to the file /path/rapidsms.log. They’ll be formatted by the default formatter.
Then configure the rapidsms logger to send messages to that handler:
LOGGING = {
...
'loggers': {
'rapidsms': {
'handlers': ['rapidsms_file'],
'propagate': True,
'level': 'DEBUG',
},
},
...
}
Setting level to DEBUG means all messages of level DEBUG and lower will be passed through (that’s all of them).
The logger name rapidsms means any logger to a name that matches that (rapidsms, rapidsms.models, etc) will be passed to this handler to handle.
Setting propagate to True means the same messages will be passed to other handlers if they also match. (This handler does not consume the messages.)
If you created your project with the latest rapidsms-project-template and haven’t changed the settings, all rapidsms logging will be written to rapidsms.log in your project directory.
We believe RapidSMS needs to treat our documentation like we treat our code. It’s what you’re reading now and is generally the first point of contact for new developers. We value great, well-written documentation and aim to improve it as often as possible. And we’re always looking for help with documentation!
The official documentation is available on Read the Docs. This is the compiled HTML version. However, we edit it as a collection of text files for maximum flexibility. These files live in the top-level docs/ directory of a RapidSMS release. If you’d like to start contributing to our docs, get the development version of RapidSMS from the source code repository (see Installing the latest development version).
Before building the documentation, you must have a version of RapidSMS installed. See the Installing the latest development version guide for instructions on installing RapidSMS.
We use the Sphinx documentation system (based on docutils). To build the documentation locally, you’ll need to install Sphinx:
pip install Sphinx
Then, building the HTML is easy. Just run make from the docs directory:
make html
(or make.bat html on Windows)
To get started contributing, you’ll want to read the reStructuredText Primer. After that, you’ll want to read about the Sphinx-specific markup that’s used to manage metadata, indexing, and cross-references.
Typically, documentation changes come in two forms:
If you’re interested in helping out, a good starting point is with the documentation label on the GitHub issue tracker.