Welcome to TRI-ML/dgp! This page details contribution guidelines and
GitWorkflow.
- Fork
TRI-ML/dgpinto your GitHub account. - Clone your fork
<your-user-name>/dgpon your local machine. - Add
upstreamremote:cd dgpgit remote add upstream git@github.com:TRI-ML/dgp.gitgit remote set-url --push upstream no_push
- Enable githooks (linting, autoformatting) via:
dgp$ make link-githooksPlease follow Getting Started to setup dockerized development workflow.
This section assumes you have followed the initial setup instructions and enable the githooks.
git fetch upstreamgit checkout -b my_pr_branch upstream/master
There should only be a single commit with all the changes when making a pull request. Please squash the commits before opening a PR. This repository follows Conventional Commits 1.0.0 for the commit message convention. All commit messages will be verified by commitlint.
The commit message should be structured as follows:
<type>: <description>
[optional body]
[optional footer(s)]When naming the commit, the first line (commit title) should be a short summary
in ALL lowercase and starts with a type.
Common types
can be:
schema: changes to dgp protobuf schemafeat: introduce new featuresfix: bugfixtest: changes to unit testsbuild: changes that affect the package build or external dependencies (example: requirement.txt and Dockerfile updates)docs: documentation only changesci: changes to CI/CD configuration files and settingsstyle: changes that do not affect the meaning of the code (formatting, linting, etc)refactor: a code change that neither fixes a bug nor adds a featureperf: changes that improve performance (example: speed up dataset index building)revert: revert a commit
For example, adding a new PyTorch DatasetClass:
feat: add synchronized datasetclass
- add synchronized datasetclass to load time-synchronized samples
- speed up build_item_indexAdd new protobuf schema:
schema: add map schema
- add protobuf schema for map
- modify dgp.proto.dataset to hold map messageNOTE: For adding any new proto schema, please run
make build-proto and also commit the compiled protos. Further, these
proto schema and their compiled protos must be separated from
code changes into one independent commit and PR.
DGP runs isort and yapf to autoformat the files in pre-commit, and perform
additional linting using pylint in pre-push. One can enable githooks via:
dgp$ make link-githooksPlease follow this procedure to open a pull request. Also note, the git hooks require that tools such as isort and yapf are installed on the machine doing the git push. If these are not available on your system, you will first need to install them, ideally in the docker container or in a virtual environment.
All changes require unit tests. PRs can only be merged if the code coverage score is greater than the minimum acceptable code coverage. The minimum acceptable code coverage score is set here.
- Rebase to master
git fetch upstreamgit rebase upstream/master
- Push to your GitHub fork
git push origin
- Create "Pull Request" (PR)
- Go to your fork in GitHub and create a pull request per these instructions
- CI coverage
- You can run unittests via
make docker-run-tests. - You can make PRs with no reviewers to get CI coverage.
- All pull requests must pass certain stages in order to be merged:
- You can run unittests via
The pull request has a reviewable.io review associated with it. (You will need to reload the pull request page before the reviewable.io button appears). Please add at least one reviewer to review. Note: Any proto schema changes require at least 2 reviewers.
Once all reviews are complete, and all checks have completed with passing
scores, the author can click the button Squash & Merge to merge the PR.
Docstrings should follow the Numpy Docstring Standard
All commits (except protobuf schema changes) should include test cases. Test cases should be based on pytest. PRs can only be merged if the code coverage score is greater than the minimum acceptable code coverage.