How To Contribute

Thank you for considering contributing to keras-adf! Everyone is very welcome to help us improve it.

This document is intended to help you get started and make the process of contributing more accessible. Do not be afraid ask if something is unclear!

Workflow

  • Every contribution is welcome, no matter how small! Do not hesitate to submit fixes for typos etc.

  • Try to stick to one change only per pull request.

  • Add tests and docs for your code. Contributions missing tests or documentation can not be merged.

  • Make sure all changes pass our CI. We will not give any feedback until it is green unless you ask for it.

  • Once you have addressed review feedback bump the pull request with a short note, so we know you are done.

Code

  • We follow PEP 8 and PEP 257.

  • We use numpy style for docstrings:

    def func(x):
      """Short summary.
    
      Longer description text.
    
      Parameters
      ----------
      param1 : int
          The first parameter.
      param2 : str
          The second parameter.
    
      Returns
      -------
      bool
          True if successful, False otherwise.
      """
    
  • If you make additions or changes to the public APIs, tag the docstring with ..  versionadded:: 19.5.0 NOTE or ..  versionchanged:: 19.7.0 NOTE.

  • We use isort to sort all imports, and follow the Black code style with a line length of 79 characters. The formatting can be automated. If you run our tox test suite before committing, or install our pre-commit hooks (see below), you do not have to spend any thoughts or time on formatting your code at all. Otherwise CI will catch it, but then you may waste time before getting the green light.

Tests

  • Write assertions as expected == actual for consistency:

    x = f(...)
    
    assert 42 == x.important_attribute
    assert "foobar" == x.another_attribute
    
  • Get the latest version of tox to run our tests with one single tox call. It will ensure the test suite runs with all the correct dependencies against all supported Python versions just as it will in our CI. If you lack Python versions, you can can limit the environments like tox -e py27,py35.

  • Write docstrings for your tests. Here are tips for writing good test docstrings.

Documentation

  • Use semantic newlines in reStructuredText files (files ending in .rst):

    This is a sentence.
    This is another sentence.
    
  • If you start a new section, add two blank lines before and one blank line after the header, except if two headers follow immediately after each other:

    Last line of previous section.
    
    
    Header of New Top Section
    -------------------------
    
    Header of New Section
    ^^^^^^^^^^^^^^^^^^^^^
    
    First line of new section.
    
  • If you add a new feature, demonstrate it on the examples page!

Changelog

If you make a change noteworthy for all users, there needs to be a changelog entry to make everyone else aware about it!

We use the towncrier package to manage our changelog. towncrier uses independent files – called fragments – for each pull request instead of one monolithic changelog file. On release, all fragments are compiled into the CHANGELOG.rst.

You don’t need to install towncrier yourself, since you will not be the one releasing a new version. You just have to abide by a few simple rules:

  • For each pull request, add a new file into changelog.d with a filename adhering to the pr#.(change|deprecation|breaking).rst schema: For example, changelog.d/42.change.rst for a non-breaking change that is proposed in pull request #42.

  • As with other docs, please use semantic newlines within news fragments.

  • Wrap symbols like modules, functions, or classes into double backticks so they are rendered in a monospace font.

  • Wrap arguments into asterisks like in docstrings.

  • If you mention functions or other callables, add parentheses at the end of their names for readability: func() or object.method().

  • Prefer simple past tense or constructions with “now”. For example:

    • Added func().

    • func() now does not crash with argument 42.

  • If you want to reference multiple issues, copy the fragment content to another filename. towncrier merges all fragments with identical contents into one entry with multiple pull request links.


tox -e changelog will render the current changelog to the terminal if you want to double check your fragments.

Local Development Environment

You can (and should) run our test suite using tox. For a more traditional environment we recommend to develop using the latest Python 3 release.

Create a new virtual environment using your favourite environment manager. Then get an up to date checkout of the keras-adf repository:

$ git clone git@github.com:jmaces/keras-adf.git

or if you want to use git via https:

$ git clone https://github.com/jmaces/keras-adf.git

Change into the newly created directory and activate your virtual environment if you have not done that already. Install an editable version of keras-adf along with all its development requirements:

$ cd keras-adf
$ pip install -e '.[dev]'

Now you should be able to run tests via

$ python -m pytest

as well as building documentation via

$ cd docs
$ make html

which can then be found in docs/_build/html/.

To avoid committing code not following our style guide, we advise you to install pre-commit 1 hooks:

$ pre-commit install

They can also be run manually anytime (as our tox does) using:

$ pre-commit run --all-files
1

pre-commit should have been installed into your virtual environment automatically when you ran pip install -e '.[dev]' above. If pre-commit is missing, you may need to re-run pip install -e '.[dev]'.

Governance

keras-adf was created as a byproduct of a research project and is maintained by volunteers. We are always open to new members that want to help. Just let us know if you want to join the team.

Everyone is welcome to help review/merge pull requests of others but nobody is allowed to merge their own code.

Jan Maces acts as the maintainer of the project and has the final say over decisions.


Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. Please report any harm to Jan Maces in any way you find appropriate.

Thank you again for considering contributing to keras-adf!

Contributor Covenant Code of Conduct

Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, 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.

Our Standards

Examples of behavior that contributes to creating a positive environment include:

  • Using welcoming and inclusive language

  • Being respectful of differing viewpoints and experiences

  • Gracefully accepting constructive criticism

  • Focusing on what is best for the community

  • Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

  • The use of sexualized language or imagery and unwelcome sexual attention or advances

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

  • Public or private harassment

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

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

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers 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, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at janmaces[at]gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq