OpenAtlas is developed with some standards in mind.
Only open source libraries (e.g. jQuery) and open source software requirements (e.g. a PostgreSQL database) are used.
All non-code files (e.g. logo) should be open too (CC BY-SA 4.0).
This guaranties that the application can be shared as open source (GPL 2) e.g. on GitHub.
If 3rd party software or media is used it is important to:
- Check the license for compatibility
- Store them in openatlas/static/vendor
- Add a license file if available
Python code should be covered by tests with assertions. We aim for 100% code coverage although some parts (e.g. mail functions) may be excluded with the # pragma: no cover option.
Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing.
The first command is the most "tolerant" one, the 3rd is the most "strict".
mypy runserver.py --ignore-missing-imports mypy runserver.py --ignore-missing-imports --disallow-untyped-defs mypy runserver.py --ignore-missing-imports --strict
Style and coding standards¶
We are using PEP 8 Style Guide for Python Code with the exception of allowing a line length of 100 characters.
There are various tools to check for coding standards e.g. in the IDE PyCharm you can configure hints, add the Mypy plugin and more.
Alternatively you can use tools like tabnanny in the root of your project.
python -m tabnanny .
We are using HTML 5 and the site should be validating correctly.
Exceptions may be acceptable if (harmless) non valid HTML 5 is produced by 3rd party libraries.
Of course we do our best to avoid them in the first place but if bugs in already released versions get apparent they always have the highest priority.