Skip to content

Latest commit

 

History

History
118 lines (82 loc) · 4.18 KB

CONTRIBUTING.md

File metadata and controls

118 lines (82 loc) · 4.18 KB

Contributing to LuxonisTrain

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

Table Of Contents

Pre-requisites

Clone the repository and navigate to the root directory:

git clone [email protected]:luxonis/luxonis-train.git
cd luxonis-train

Install the development dependencies by running pip install -r requirements-dev.txt or install the package with the dev extra flag:

pip install -e .[dev]

Note

This will install the package in editable mode (-e), so you can make changes to the code and run them immediately.

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.
    • Some hooks will also modify the files in-place to fix found issues.

Documentation

We use the Epytext markup language for documentation. To verify that your documentation is formatted correctly, run the following command:

pydoctor --docformat=epytext luxonis_train

Editor Support:

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

Type Checking

The codebase is type-checked using pyright v1.1.380. To run type checking, use the following command in the root project directory:

pyright --warnings --level warning --pythonversion 3.10 luxonis_train

Editor Support:

Tests

We use pytest for testing. The tests are located in the tests directory. To run the tests with coverage, use the following command:

pytest --cov=luxonis_train --cov-report=html

This command will run all tests and generate HTML coverage report.

Tip

The coverage report will be saved to htmlcov directory. If you want to inspect the coverage in more detail, open htmlcov/index.html in a browser.

Tip

You can choose to run only the unit-tests or only the integration tests by adding -m unit or -m integration to the pytest command.

Important

If a new feature is added, a new test should be added to cover it. The minimum overall test coverage for a PR to be merged is 90%. The minimum coverage for new files is 80%.

GitHub Actions

Our GitHub Actions workflow is run when a new PR is opened.

  1. First, the pre-commit hooks must pass and the documentation must be built successfully.
  2. Next, the type checking is run.
  3. If all previous checks pass, the tests are run.

Tip

Review the GitHub Actions output if your PR fails.

Important

Successful completion of all the workflow checks is required for merging a PR.

Making and Submitting Changes

  1. Make changes in a new branch.
  2. Test your changes locally.
  3. Commit your changes (pre-commit hooks will run).
  4. Push your branch and create a pull request.
  5. The team will review and merge your PR.