Skip to content

Latest commit

 

History

History
90 lines (59 loc) · 4.13 KB

CONTRIBUTING.md

File metadata and controls

90 lines (59 loc) · 4.13 KB

Contributing guidelines

Interested in contributing to TFX Addons? We appreciate all kinds of help and are working to make this guide as comprehensive as possible. Please let us know if you think of something we could do to help lower the barrier to contributing.

How to become a contributor and submit your own code

Contributor License Agreements

We'd love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.

Please fill out either the individual or corporate Contributor License Agreement (CLA).

  • If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an individual CLA.
  • If you work for a company that wants to allow you to contribute your work, then you'll need to sign a corporate CLA.

Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests.

NOTE: Only original source code from you and other people that have signed the CLA can be accepted into the main repository.

Contributing code

If you have improvements to TFX Addons, send us your pull requests! For those just getting started, Github has a howto.

SIG team members will be assigned to review your pull requests. Once the pull requests are approved and pass continuous integration checks, we will merge the pull requests.

Development tips

We use pre-commit to validate our code before we push to the repository. We use push over commit to allow more flexibility.

Here's how to install it locally:

  • Create virtual environemnt: python3 -m venv env
  • Activate virtual environment: source env/bin/activate
  • Upgrade pip: pip install --upgrade pip
  • Install test packages: pip install -e ".[test]"
  • Install pre-commit hooks for push hooks: pre-commit install pre-push
  • Change and commit files. pre-commit will run the tests and linting before you push. You can also manually trigger the tests and linting with pre-commit run --hook-stage push --all-files

Note that pre-commit will be run via GitHub Action automatically for new PRs.

Contribution guidelines and standards

Before sending your pull request for review, make sure your changes are consistent with the guidelines and follow our coding style.

General guidelines and philosophy for contribution

  • Include unit tests when you contribute new features, as they help to a) prove that your code works correctly, and b) guard against future breaking changes to lower the maintenance cost.
  • Bug fixes also generally require unit tests, because the presence of bugs usually indicates insufficient test coverage.
  • When you contribute a new feature to TensorFlow, the maintenance burden is (by default) transferred to the SIG team. This means that benefit of the contribution must be compared against the cost of maintaining the feature.

Python coding style

Changes to Python code should conform to Google Python Style Guide with indent width of 2 spaces.

This is enforced using pre-commit hooks that run: yapf, isort, pylint.

To run the checks manually, follow Development tips and run:

pre-commit run --hook-stage push --files tfx_addons/__init__.py

License

Include a license at the top of new files.

Pre-commit will add the files for you if installed.

pre-commit run --hook-stage push --files tfx_addons/__init__.py

Testing your code

We use pytest to run tests. You can run tests locally using:

  • Create virtual environemnt: python3 -m venv env
  • Activate virtual environment: source env/bin/activate
  • Install test packages: pip install -e ".[all,test]"
  • Run tests: pytest