mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-26 16:35:05 +00:00
51 lines
1.6 KiB
Markdown
51 lines
1.6 KiB
Markdown
# Contributing
|
|
|
|
Run all commands below from the repository root. See [README.md](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](pyproject.toml).
|
|
|
|
```bash
|
|
ruff check --fix && ruff format # Format
|
|
ruff check --no-cache && ruff format --check --no-cache # Check
|
|
```
|
|
|
|
### C++
|
|
|
|
Use [scripts/format_csrc.sh](scripts/format_csrc.sh) to format C++ and CUDA code under `csrc/`. Install `clang-format` or set `CLANG_FORMAT` to its executable path.
|
|
|
|
```bash
|
|
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.ci` for GPU core tests.
|
|
- Use `@pytest.mark.ci_npu` for NPU-only core tests.
|
|
- Apply both `@pytest.mark.ci` and `@pytest.mark.ci_npu` to tests that must run on both GPUs and NPUs.
|
|
|
|
### Running tests
|
|
|
|
Run tests in an environment with the required hardware, models, and dependencies:
|
|
|
|
```bash
|
|
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
|
|
```
|