We appreciate your interest in our project and welcome external contributions.
We use ruff
and black
to perform and check code formatting, please use the following commands to install and use them.
pip install black flake8
python3 -m black .
python3 -m ruff .
Or you can use pre-commit
, which performs the corresponding checks before git commit
automatically.
# Install pre-commit and pre-configured git hooks
pip install pre-commit
pre-commit install
# The code check will be done automatically before committing the code
git commit -m "test"
# Or you can also trigger the code check manually
pre-commit run
Generally speaking, every public function or class method you add requires a function annotation and a docstring. Function annotations are marked with typing. Docstrings are in Google style. Sample code is show below.
def test_func(param1: int, param2: str) -> bool:
"""Documentation for the function
Args:
param1 (int): The first parameter.
param2 (str): The second parameter.
Returns:
bool: The return value. True for success, False otherwise.
"""
As for the model converter, when an operator or optimization pass is added, the corresponding unit tests need to be written as well. The location of the code for unit tests: