This guide is intended for our internal development team. It outlines our workflow and standards for contributing to this project.
We use pre-commit hooks to ensure code quality and consistency:
- Install pre-commit (see pre-commit.com).
- Clone the repository and run
pre-commit install
in the root directory. - 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.
We use the Epytext markup language for documentation. To verify that your documentation is formatted correctly, follow these steps:
- Download
get-docs.py
script - 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.
- If the script runs successfully and produces
- 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
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.
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.
- Checks and tests are run automatically when you open a pull request.
- For the tests to run, the pre-commit hook must pass and the documentation must be built successfully.
- Review the GitHub Actions output if your PR fails.
- Fix any issues to ensure that all checks and tests pass.
- Make changes in a new branch.
- Test your changes locally.
- Commit (pre-commit hook will run).
- Push to your branch and create a pull request. Always request a review from:
- Any other relevant team members can be added as reviewers as well.
- The team will review and merge your PR.