Thank you for your interest in contributing to NineToothed! This document provides guidelines and instructions for contributing to this project.
Note: This guide is still being actively improved.
If you find a bug or have a feature request, please open an issue on GitHub Issues. When reporting a bug, include:
- A clear description of the problem.
- Steps to reproduce the issue.
- Expected vs. actual behavior.
- Your environment (Python version, OS, GPU, etc.).
-
Fork and clone the repository:
git clone https://github.com/InfiniTensor/ninetoothed.git cd ninetoothed -
Install the package in editable mode with all optional dependencies:
pip install -e .[all]
-
Install development dependencies:
pip install -r requirements.txt
-
Set up Git hooks:
git config core.hooksPath .githooks
This enables the project's commit message validation and branch name checks.
We follow GitHub flow. The main steps are:
- Create a branch.
- Make changes.
- Create a pull request (PR).
- Address review comments.
- Merge the PR.
- Delete the branch.
Use kebab-case (lowercase letters, numbers, and hyphens) for branch names, with a maximum of 50 characters. This is enforced by the pre-push hook.
- Valid:
develop-visualization,fix-123-memory-leak,add-conv2d-support - Invalid:
Develop_Visualization,fix_memory_leak,myBranch
The following rules apply to both commit messages and PR titles:
- Capitalize the first letter.
- Do not end with punctuation (
.,!,?, etc.). - Use imperative mood (e.g., "Add feature" not "Added feature").
These rules are enforced by the commit-msg hook.
Valid examples:
Add user authenticationFix memory leak in tensor allocationRefactor code generation module
Invalid examples:
add user authentication(lowercase)Fix memory leak.(trailing punctuation)Added user authentication(past tense)
Before merging a PR, you must provide the pytest output in the PR description to confirm that all tests pass with your latest changes. The PR template includes a section for this. See #30 for a reference example.
Follow PEP 8 as the primary style guide. For anything PEP 8 does not cover in detail, refer to the GDScript style guide—while it targets a different language, its non-syntax conventions are still applicable.
Run Ruff before every commit:
ruff format && ruff checkThis is also enforced by the commit-msg hook.
-
Comments should be complete English sentences, starting with a capital letter and ending with punctuation. Use Markdown syntax when referencing code within comments.
-
Error messages and framework conventions: When a framework has an established convention (e.g.,
pytest.skipmessages are typically lowercase without a trailing period), follow that convention. Otherwise, use the same rules as comments. -
Function signatures: If a function has no docstring or comment, do not add a blank line between the function signature and the function body.
-
Blank lines around control flow: Add a blank line before and after
if,for, and similar statements. -
Return statements: Add a blank line before a
returnstatement, unless it directly follows a control flow statement likeiforfor. -
Docstrings: Follow PEP 257 conventions.
Run the test suite:
pytestRun the linter:
ruff checkRun the formatter:
ruff formatTo run a full local CI check before pushing:
ruff format && ruff check && pytestThis section is primarily for maintainers.
-
Create an
increment-version-numberbranch and update theversionfield inpyproject.toml. Follow Semantic Versioning 2.0.0 for version numbers. -
Merge the branch via the standard code development workflow.
-
Create a tag on the
masterbranch using the newly merged commit:git checkout master git pull origin master git tag -a v<major>.<minor>.<patch> -m "NineToothed version <major>.<minor>.<patch>"
-
Push the tag to the remote repository:
git push origin v<major>.<minor>.<patch>
-
Verify the release by checking: