Contributor’s Guide

If you’re reading this, you’re probably interested in contributing to the project. Thank you very much! Open source projects live-and-die based on the support they receive from others, and the fact that you’re even considering contributing to the discovery-transition-ds project is very generous of you.

This document lays out guidelines and advice for contributing to this project. If you’re thinking of contributing, please start by reading this document and getting a feel for how contributing to this project works. If you have any questions, feel free to reach out to gigas64, the primary maintainer.

The guide is split into sections based on the type of contribution you’re thinking of making, with a section that covers general guidelines for all contributors.

Be Cordial

Be cordial or be on your way. —Kenneth Reitz

This project has one very important rule governing all forms of contribution, including reporting bugs or requesting features. This golden rule is “be cordial or be on your way”.

All contributions are welcome, as long as everyone involved is treated with respect.

Get Early Feedback

If you are contributing, do not feel the need to sit on your contribution until it is perfectly polished and complete. It helps everyone involved for you to seek feedback as early as you possibly can. Submitting an early, unfinished version of your contribution for feedback in no way prejudices your chances of getting that contribution accepted, and can save you from putting a lot of work into a contribution that is not suitable for the project.

Contribution Suitability

The project maintainer has the last word on whether or not a contribution is suitable for submission. All contributions will be considered carefully, but from time to time, contributions will be rejected because they do not suit the current goals or needs of the project.

If your contribution is rejected, don’t despair! As long as you followed these guidelines, you will have a much better chance of getting your next contribution accepted.

Code Contributions

Steps for Submitting Code

When contributing code, you’ll want to follow this checklist:

  1. Fork the repository on GitHub.

  2. Run the tests to confirm they all pass on your system. If they don’t, you’ll need to investigate why they fail. If you’re unable to diagnose this yourself, raise it as a bug report by following the guidelines in this document: Bug Reports.

  3. Write tests that demonstrate your bug or feature. Ensure that they fail.

  4. Make your change.

  5. Run the entire test suite again, confirming that all tests pass including the ones you just added.

  6. Send a GitHub Pull Request to the main repository’s master branch. GitHub Pull Requests are the expected method of code collaboration on this project.

The following sub-sections go into more detail on some of the points above.

Code Review

Contributions will not be merged until they’ve been code reviewed. You should implement any code review feedback unless you strongly object to it. In the event that you object to the code review feedback, you should make your case clearly and calmly. If, after doing so, the feedback is judged to still apply, you must either apply the feedback or withdraw your contribution.

New Contributors

If you are new or relatively new to Open Source, welcome! discovery-transition-ds aims to be a gentle introduction to the world of Open Source. If you’re concerned about how best to contribute, please consider mailing the maintainer (listed above) and asking for help.

Please also check the Get Early Feedback section.

Python Code Style

The Zen of Python tells us that “Readability counts” and “Explicit is better than implicit.” These are necessary characteristics of Python. When we write code, we do it for end-users, developers, and ourselves.

The discovery-transition-ds codebase uses the PEP 8 code style. python Enhancement Proposal 8 or PEP 8 is a comprehensive styling guide aiming to increase the readability and overall understanding of Python code. PEP 8 is only a guide and you will run into code that just doesn’t apply. The key is the use the style guide whenever you can as it will help you and everyone else to read, understand and work on it.

Python Docstrings

As important as code style is, documenting your code is a critical support to that code. A good percentage of writing new classes, methods or functions must be in writing good, accurate docstrings.

The discovery-transition-ds codebase uses the PEP 257 outlining docstring semantics and conventions associated with Python docstrings.

There are four primary types of docstrings, all of which follow the above recommendations:

  • NumPy/SciPy docstrings

  • Google docstrings

  • reStructuredText

  • Epytext

by convention we use eStructuredText as the official Python documentation style. All functions, methods, and classes should contain docstrings. Object data model methods (e.g. __repr__) are typically the exception to this rule.

as an example

def days_release(date: str) -> int64:
    """Return the difference in days between the current date and game release date.

    :param date: Release date in string format.
    :returns: Integer difference in days.
    """
    current_date = datetime.now()
    release_date_dt = datetime.strptime(date, "%B %d, %Y") # Convert date string into datetime object
    return (current_date - release_date_dt).days

note the parameter and return type are defined in the function call.

Documentation Contributions

Documentation improvements are always welcome! The documentation files live in the docs/ directory of the codebase. They’re written in reStructuredText, and use Sphinx to generate the full suite of documentation.

When contributing documentation, please do your best to follow the style of the documentation files. This means a soft-limit of 79 characters wide in your text files and a semi-formal, yet friendly and approachable, prose style.

When presenting Python code, use single-quoted strings ('hello' instead of "hello").

Bug Reports

Bug reports are hugely important! Before you raise one, though, please check through the GitHub issues, both open and closed, to confirm that the bug hasn’t been reported before. Duplicate bug reports are a huge drain on the time of other contributors, and should be avoided as much as possible.

Feature Requests

discovery-transition-ds is always looking for new ideas to improve features and add capabilities. With this said, it has a clear remit and finite space to avoid bloating and feature spread.

One of the most important skills to have while maintaining a largely-used open source project is learning the ability to say “no” to suggested changes, while keeping an open ear and mind.

If you believe there is a feature or capability missing, try writing a custom packge that extends an existing capability or write your own, extending the abstracts and present this, but please do be aware that your contribution may not be accepted.