Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 3.19 KB

CONTRIBUTING.md

File metadata and controls

78 lines (56 loc) · 3.19 KB

Contributing to the kfp SDK

KFP v2 for SDK is under development on the master branch.

To contribute to v1, please go to sdk/release-1.8 branch to submit your change.

For general contribution guidelines including pull request conventions, see pipelines/CONTRIBUTING.md.

Requirements

All development requirement versions are pinned in requirements-dev.txt.

Testing

We suggest running unit tests using pytest. From the project root, the following runs all KFP SDK unit tests:

pytest sdk/python

To run tests in parallel for faster execution, you can run the tests using the pytest-xdist plugin:

pytest sdk/python -n auto

Code Style

Dependencies for code style checks/changes can be found in the kfp SDK requirements-dev.txt.

Style Guide [Required]

The KFP SDK follows the Google Python Style Guide.

Formatting [Required]

Please format your code using yapf according to the .style.yapf file.

From the project root, run the following code to format your code:

yapf --in-place --recursive ./sdk/python

Docformatter [Required]

We encourage you to lint your docstrings using docformatter.

From the project root, run the following code to lint your docstrings:

docformatter --in-place --recursive ./sdk/python

Formatting Imports [Required]

Please organize your imports using isort according to the .isort.cfg file.

From the project root, run the following code to format your code:

isort sdk/python --sg sdk/python/kfp/deprecated

Pylint [Encouraged]

We encourage you to lint your code using pylint according to the project .pylintrc file.

From the project root, run the following code to lint your code:

pylint ./sdk/python/kfp

Note: kfp is not currently fully pylint-compliant. Consider substituting the path argument with the files touched by your development.

Static Type Checking [Encouraged]

Please use mypy to check your type annotations.

From the project root, run the following code to lint your docstrings:

mypy ./sdk/python/kfp/

Note: kfp is not currently fully mypy-compliant. Consider substituting the path argument with the files touched by your development.

Pre-commit [Recommended]

Consider using pre-commit with the provided .pre-commit-config.yaml to implement the above changes:

pre-commit install