Developer Guidelines¶
Code of Conduct¶
Note
Before we start please be aware that contributors to this project are expected to act respectfully toward others in accordance with the OSGeo Code of Conduct.
Contribution Workflow¶
The Birdhouse project openly welcomes contributions (bug reports, bug fixes, code enhancements/features, etc.). This document will outline some guidelines on contributing to birdhouse. As well, the birdhouse Communication is a great place to get an idea of how to connect and participate in birdhouse community and development where everybody is welcome to rise questions and discussions.
Here are some basic guides to smoothly contribute to birdhouse:
Source code¶
The source code of all birdhouse components is available on GitHub. Respecting the git mechanisms you can fork, clone and pull source-code into your repositories for modification and enhancement. Once your improvement is ready, make a pull request to integrate your work into the origin birdhouse repositories.
Note
Please keep your forks close to the origin repositories and don’t forget the pull requests.
Issue tracker¶
To keep track on the contribution and development, please use the issue tracker on GitHub for the corresponding birdhouse component.
Please find the coding guide in the Wiki.
Code Style¶
A good start to contribute is an enhancement of existing code with better or new functions. To respect a common coding style, Birdhouse uses PEP8 checks to ensure a consistent coding style. Currently the following PEP8 rules are enabled in setup.cfg
:
[flake8]
ignore=F401,E402
max-line-length=120
exclude=tests
See the flake8 documentation on how to configure further options.
To check the coding style run flake8
:
$ flake8 emu # emu is the folder with python code
# or
$ make pep8 # make calls flake8
To make it easier to write code according to the PEP8 rules enable PEP8 checking in your editor. In the following we give examples how to enable code checking for different editors.
Atom¶
- Homepage: https://atom.io/
- PEP8 Atom Plugin: https://github.com/AtomLinter/linter-pep8
Sublime¶
- Install package control if you don’t already have it: https://packagecontrol.io/installation
- Follow the instructions here to install Python PEP8 Autoformat: https://packagecontrol.io/packages/Python%20PEP8%20Autoformat
- Edit the settings to conform to the values used in birdhouse, if necessary
- To show the ruler and make wordwrap default, open Preferences → Settings—User and use the following rules
{
// set vertical rulers in specified columns.
"rulers": [79],
// turn on word wrap for source and text
// default value is "auto", which means off for source and on for text
"word_wrap": true,
// set word wrapping at this column
// default value is 0, meaning wrapping occurs at window width
"wrap_width": 79
}
Todo
Add PEP8 instructions for more editors: PyCharm, Kate, Emacs, Vim, Spyder.
Writing functions:¶
Todo
Guideline for writing functions. Where to place, how to comment.
Writing a WPS process¶
In birdhouse, we are using the PyWPS implementation of a Web Processing Service. Please read the PyWPS documentation on how to implement a WPS process.
Note
To get started quickly, you can try the Emu WPS with some example processes for PyWPS.
Writing tests¶
Todo
Guideline to write tests. Look at the Emu to see examples.
Writing documentation¶
Last but not least, a very very important point is to write a good documentation about your work! Each WPS (bird) has a docs folder for this where the documentation is written in reStructuredText and generated with Sphinx.
The documentation is automatically published to ReadTheDocs with GitHub webhooks. It is important to keep the Code Style and write explanations to your functions. There is an auto-api for documentation of functions.
Todo
explanation of enabling spinx automatic api documentation.
The main documentation (which you are reading now) is the starting point to get an overview of birdhouse. Each birdhouse component comes with its own Sphinx documentation and is referenced by the main birdhouse document.
Environment with conda¶
Todo
How to create a conda package
Make your own Bird¶
If you are familiar with all the upper chapters you are ready to create your own WPS. The WPS in birdhouse are named after birds, so this section is giving you a guidline of how to make your own bird. Birds are sorted thematically, so before setting up a new one, make sure it is not already covered and just missing some processes and be clear in the new thematic you would like to provide.
We have now a Cookiecutter template to create a new bird (PyWPS application). It is the recommended and fastest way to create your own bird:
https://github.com/bird-house/cookiecutter-birdhouse
Note
The cookiecutter is brand-new. Please give feedback and help to improve it.