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.
All development requirement versions are pinned in requirements-dev.txt.
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
Dependencies for code style checks/changes can be found in the kfp SDK requirements-dev.txt.
The KFP SDK follows the Google Python Style Guide.
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
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
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
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.
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.
Consider using pre-commit
with the provided .pre-commit-config.yaml
to implement the above changes:
pre-commit install