Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 3.45 KB

CONTRIBUTING.md

File metadata and controls

81 lines (60 loc) · 3.45 KB

Contributing to LuxonisML

This guide is intended for our internal development team. It outlines our workflow and standards for contributing to this project.

Table of Contents

Pre-commit Hooks

We use pre-commit hooks to ensure code quality and consistency:

  1. Install pre-commit (see pre-commit.com).
  2. Clone the repository and run pre-commit install in the root directory.
  3. The pre-commit hook will now run automatically on git commit.
    • If the hook fails, it will print an error message and abort the commit.
    • It will also modify the files in-place to fix any issues it can.

Documentation

We use the Epytext markup language for documentation. To verify that your documentation is formatted correctly, follow these steps:

  1. Download get-docs.py script
  2. Run python3 get-docs.py luxonis_ml in the root directory.
    • If the script runs successfully and produces docs.json file, your documentation is formatted correctly.
    • NOTE: If the script fails, it might not give the specific error message. In that case, you can run the script for each file individually until you find the one that is causing the error.

Editor Support

  • PyCharm - built in support for generating epytext docstrings
  • Visual Studie Code - AI Docify extension offers support for epytext
  • NeoVim - vim-python-docstring supports epytext style

Tests

We use pytest for testing. The tests are located in the tests directory. You can run the tests locally with:

pytest tests --cov=luxonis_ml

This command will run all tests and print a coverage report. The coverage report is only informational for now, but we may enforce a minimum coverage in the future.

If a new feature is added, a new test should be added to cover it.

GitHub Actions

Our GitHub Actions workflow is run when a new PR is opened. It first checks that the pre-commit hook passes and that the documentation builds successfully. The tests are run only if the pre-commit hook and documentation build pass. Successful tests are required for merging a PR.

  1. Checks and tests are run automatically when you open a pull request.
  2. For the tests to run, the pre-commit hook must pass and the documentation must be built successfully.
  3. Review the GitHub Actions output if your PR fails.
  4. Fix any issues to ensure that all checks and tests pass.

Making and Reviewing Changes

  1. Make changes in a new branch.
  2. Test your changes locally.
  3. Commit (pre-commit hook will run).
  4. Push to your branch and create a pull request. Always request a review from:
  5. Any other relevant team members can be added as reviewers as well.
  6. The team will review and merge your PR.