Development principles and contribution guidelines

In order to create a high-quality software product, the AlekSIS developers have agreed upon fundamental principles governing the code layout, coding style and repository management for AlekSIS and all official apps.

Coding layout and style

The coding style is defined in PEP 8, with the following differences and decisions:

  • The defaults of the black code formatter are used - This implies all string literals usin double-quotes, if it does not lead

    to more escaping. As proposed by black: “My recommendation here is to keep using whatever is faster to type and let Black handle the transformation.”

  • The maximum line length is 100 characters

  • Imports are structured in five blocks, each of them sorted as defined in PEP 8 and the Django style guide:

    1. Standard library imports

    2. Django imports

    3. Third-party imports

    4. Imports from AlekSIS core and other apps (absolute imports)

    5. Imports from the same AlekSIS app (realtive imports)

    Use isort to take care of this

For the layout of source trees and style recommendations specific to Django, the Django coding style is a good source of information, together with the Django Best Practices collection.

To ensure code is styled correctly, before commiting, run:

tox -e reformat

Text documents

If there is no objective reason against it, all text documents accompanying the source use reStructuredText.

Working with the Git repository

The Git repository shall be used as a historic documentation of development and as change management. It is important that the Git commit history describes waht was changed, by whom and why.

Help and information on Git for beginners are available in the Git guide

Feature and issue branches

All features and bug fixes should be developed in their own branch and later merged into the master branch as a whole. Of course, sometimes, it is sensible to not do that, e.g. for fixing mere typos and the like.

Within the feature branch, every logical step should be commited separately. It is neither required nor desired to do micro-commits about every development step. The commit history should describe the trains of thought the design and implementation is based on.

If you work on multiple issues at the same time, you have to change between branches. Never work on unrelated issues in the same branch.

Branches should either contain the number and title of the related issue (as generated by GitLab), or follow the naming convention type/name, where type is one of bugfix, feature, or refactor.

All changes on the code should be commited and pushed before stopping work on in order to prevent data loss. If a logical step is continued later, you should amend and force-push the commit.

Issue branches should be rebased onto the current master regularly to avoid merge conflicts.

Commit messages

Commit messages should be written as described in How to Write a Git Commit Message.

Commit messages should mention or even close any related issues. For merely mentioning progress on an issue, use the keyword advances; for closing an issue, use closes; for referring to a related issue for informational purposes, use cf.. This should be done in the body of the commit message.

The subject of a commit message can (and should) be prepended with a tag in square brackets if it relates to a certain part of the repository, e.g. [CI] when changing CI/CD configuration or support code, [Dev] when changing something in the development utilities, etc.

Example:

Solve LDAP connection problems

- Add the ldap-with-unicorn-dust dependency
- Configure settings.py to accept the correct groups from LDAP

Closes #10.

Merge Requests

If you think that the work on your feature branch is finished, you have to create a merge request on EduGit in order to let other developers and the maintainers take a look at it.

See below on how to submit patches if you cannot use the development platform.

Manifestos governing development

The FOSS community has created some manifestos describing several aspects of software development, to agree upon a baseline for these aspects. The AlekSIS developers have agreed to adhere to the following manifestos:

Not all theses from these manifestos are applicable. For example, most data about persons in a school information system are dictated by the school and probably governed by laws defining what and when to store. In that case, giving the user control over these decisions is not possible. Developers need to decide what should resonably be followed.

The case on supporting non-free services

Defined by the Free Software Definition, it is an essential freedom to be allowed to use free software for any purpose, without limitation. Thus, interoperability with non-free services shall not be ruled out, and the AlekSIS project explicitly welcomes implementing support for interoperability with non-free services.

However, to purposefully foster free software and services, if interoperability for a certain kind of non-free service is implemented, this must be done in a generalised manner (i.e. using open protocols and interfaces). For example, if implementing interoperability with some cloud-hosted calendar provider can be implemented either through a proprietary API, or through a standard iCalendar/Webcal interfaces, the latter is to be preferred. Lacking such support, if a proprietary service is connected through a proprietary, single-purpose interface, measures shall be taken to also support alternative free services.

Documentation

The documentation in the AlekSIS project shall consist of three layers.

Source code comments

The parts of your code that are not self-explaining have to be commented. Ideally, source code is self-explaining, in the sense that its logical structure, naming of variables, and the like makes it easy to read and understand, for a reasonably talented programmer, to follow what it does.

Docstrings

All functions, methods, classes and modules that are newly added (or changed extensively) must contain a docstring for other developers to understand what it does. Docstrings of public elements will be included in the developer documentation.

Sphinx documentation

In addition to that you should document the function or the way the app works in the project documentation (docs/ directory). Use that especially for functionality which is shared by your app for other apps (public APIs).

Your Sphinx documentation should contain what the API can and shall be sued for, and how other apps can benefit from it.

When creating a new app, also include documentation about it targeted at administrators and users. At least you have to document what new developers and users have to do in order to get a working instance of the app.

Sphinx documentation for all official apps will be published together.

Contributing to upstream

If possible and reasonable, code that can be of use to others in the general Django ecosystem shall be contributed to any upstream dependency, or a new generalised upstream dependency be created, under the most permissive licence possible.

How to contact the team

Development platform

Main development of AlekSIS is done on the EduGit platform in the AlekSIS group and discussions are held on the linked Mattermost team.

All platforms and tools mandated for development are free software and freely usable. EduGit accepts a variety of sources for login, so contributors are free to decide where they want to register in order to participate.

If any contributor cannot use the platforms for whatever reasons, patches and questions directed at the developers can also be e-mailed to <aleksis-dev@lists.teckids.org>.

Contributor Covenant Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

Our Standards

Examples of behavior that contributes to a positive environment for our community include:

  • Demonstrating empathy and kindness toward other people

  • Being respectful of differing opinions, viewpoints, and experiences

  • Giving and gracefully accepting constructive feedback

  • Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience

  • Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

  • The use of sexualized language or imagery, and sexual attention or advances of any kind

  • Trolling, insulting or derogatory comments, and personal or political attacks

  • Public or private harassment

  • Publishing others’ private information, such as a physical or email address, without their explicit permission

  • Other conduct which could reasonably be considered inappropriate in a professional setting

Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at foss@teckids.org. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the project community.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by Mozilla’s code of conduct enforcement ladder.

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.