mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-26 16:35:05 +00:00
1.6 KiB
1.6 KiB
Contributing
Run all commands below from the repository root. See README.md for environment setup.
Code formatting
Before committing, format the modified code and pass the corresponding checks.
Python
Ruff is configured in pyproject.toml.
ruff check --fix && ruff format # Format
ruff check --no-cache && ruff format --check --no-cache # Check
C++
Use scripts/format_csrc.sh to format C++ and CUDA code under csrc/. Install clang-format or set CLANG_FORMAT to its executable path.
bash scripts/format_csrc.sh # Format
bash scripts/format_csrc.sh --check # Check
Testing
Directory conventions
tests/: pytest test scripts. All tests should be discoverable by pytest by default.examples/: standalone offline inference and resource-intensive validation scripts. These typically require models or services and take longer to run; they are not collected by pytest.
Core test markers
Core tests must remain lightweight. Mark them according to the target platform:
- Use
@pytest.mark.cifor GPU core tests. - Use
@pytest.mark.ci_npufor NPU-only core tests. - Apply both
@pytest.mark.ciand@pytest.mark.ci_nputo tests that must run on both GPUs and NPUs.
Running tests
Run tests in an environment with the required hardware, models, and dependencies:
python -m pytest -v -s -m ci tests # GPU core tests
python -m pytest -v -s -m ci_npu tests # NPU core tests
python -m pytest -v -s tests # Full pytest suite