Skip to content

Guidelines for contributing developers

Nok Lam Chan edited this page Oct 4, 2024 · 7 revisions

This page explains the principles and development process that we ask contributing developers to follow.

Any contributions you make will be under the Apache 2.0 Software License.

In short, when you submit code changes, your submissions are understood to be under the same the Apache 2.0 License that covers the Kedro project. You should have permission to share the submitted code.

You don't need to contribute code to help the Kedro project. See our list of other ways you can contribute to Kedro.

Introduction

This guide is a practical description of:

  • How to set up your development environment to contribute to Kedro.
  • How to prepare a pull request against the Kedro repository.

Before you start: development set up

To work on the Kedro codebase, you will need to be set up with Git, and Make.

You will also need to create and activate virtual environment. If this is unfamiliar to you, read through our pre-requisites documentation.

Next, you'll need to fork the Kedro source code from the GitHub repository:

  • Fork the project by clicking Fork in the top-right corner of the Kedro GitHub repository
  • Choose your target account

If you need further guidance, consult the GitHub documentation about forking a repo.

You are almost ready to go. In your terminal, navigate to the folder into which you forked the Kedro code.

Run these commands to install everything you need to work with Kedro:

make install-test-requirements
make install-pre-commit

Once the above commands have executed successfully, do a sanity check to ensure that kedro works in your environment:

make test

Note: If you are working on kedro-datasets, you may need additional system dependencies . If you find the unrelated tests failing, you can either install all the dependencies, or simply go to the PR and check if CI is failing.

Get started: areas of contribution

Once you are ready to contribute, a good place to start is to take a look at the good first issues and help wanted issues on GitHub.

We focus on two areas for contribution: core and plugin:

core contribution process

Typically, we only accept small contributions to the core Kedro library.

To contribute:

  1. Create a feature branch on your forked repository and push all your local changes to that feature branch.

  2. Is your change non-breaking and backwards-compatible? Your feature branch should branch off from:

    1. main if you intend for it to be a non-breaking, backwards-compatible change.
    2. develop if you intend for it to be a breaking change.
  3. Before you submit a pull request (PR), please ensure that unit tests, end-to-end (E2E) tests and linters are passing for your changes by running make test, make e2e-tests and make lint locally; see the development set up section above.

  4. Open a PR:

    1. For backwards compatible changes, open a PR against the kedro-org:main branch from your feature branch.
    2. For changes that are NOT backwards compatible, open a PR against the kedro-org:develop branch from your feature branch.
  5. Await reviewer comments.

  6. Update the PR according to the reviewer's comments.

  7. Your PR will be merged by the Kedro team once all the comments are addressed.

We will work with you to complete your contribution, but we reserve the right to take over abandoned PRs.

Create a pull request

Give your pull request a descriptive title. Before you submit it, consider the following:

  • You should aim for cross-platform compatibility on Windows, macOS and Linux
  • We use Semantic Versioning for versioning
  • We have designed our code to be compatible with Python 3.7 onwards and our style guidelines are (in cascading order):

Ensure that your PR builds cleanly before you submit it, by running the CI/CD checks locally, as follows:

  • make lint: PEP-8 Standards (ruff, black)
  • make test: unit tests, 100% coverage (pytest, pytest-cov)
  • make e2e-tests: end-to-end tests (behave)
We place conftest.py files in some test directories to make fixtures reusable by any tests in that directory. If you need to see which test fixtures are available and where they come from, you can issue the following command pytest --fixtures path/to/the/test/location.py.

Pull request title conventions

The Kedro repository requires that you squash and merge your pull request commits, and, in most cases, the merge message for a squash merge then defaults to the pull request title.

For clarity, your pull request title should be descriptive, and we ask you to follow some guidelines suggested by Chris Beams in his post How to Write a Git Commit Message. In particular, for your pull request title, we suggest that you:

Hints on pre-commit usage

pre-commit hooks run checks automatically on all the changed files on each commit but can be skipped with the --no-verify or -n flag:

git commit --no-verify <...>

All checks will run during CI build, so skipping checks on commit will not allow you to merge your code with failing checks. You can uninstall the pre-commit hooks by running:

make uninstall-pre-commit

pre-commit will still be used by make lint, but will not install the git hooks.

Developer Certificate of Origin

We require that all contributions comply with the Developer Certificate of Origin (DCO). This certifies that the contributor wrote or otherwise has the right to submit their contribution.

All commits must be signed off by including a Signed-off-by line in the commit message:

This is my commit message

Signed-off-by: Random J Developer <random@developer.example.org>

The sign-off can be added automatically to your commit message using the -s option:

git commit -s -m "This is my commit message"

To avoid needing to remember the -s flag on every commit, you might like to set up a git alias for git commit -s. Alternatively, run make sign-off to setup a commit-msg Git hook that automatically signs off all commits (including merge commits) you make while working on the Kedro repository.

If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.

Need help?

Working on your first pull request? You can learn how from these resources:

Previous Q&A on GitHub discussions and the searchable archive of Slack discussions. You can ask new questions about the development process on Slack too!

Clone this wiki locally