Implementation:Obss Sahi Pyproject Configuration
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Packaging |
| Last Updated | 2026-02-08 12:00 GMT |
Overview
Project build configuration file defining SAHI package metadata, dependencies, CLI entry points, and tooling settings.
Description
The pyproject.toml is the central build configuration for the SAHI library. It uses the PEP 621 project metadata format with Hatchling as the build backend. It declares core runtime dependencies (OpenCV, Shapely, PyTorch, Pillow, etc.), optional dependency groups for various detection frameworks (YOLOv5, Ultralytics, MMDetection, Roboflow, HuggingFace Transformers), and development tooling (Ruff linter, pytest, MkDocs). It also registers the CLI entry point sahi mapped to sahi.cli:app.
Usage
Reference this file when setting up a SAHI development environment, understanding available optional dependencies for different model backends, or configuring the build/packaging pipeline.
Code Reference
Source Location
- Repository: Obss_Sahi
- File: pyproject.toml
- Lines: 1-319
Key Sections
[project]
name = "sahi"
version = "0.11.36"
requires-python = ">=3.8"
license = "MIT"
dependencies = [
"opencv-python<=4.11.0.86",
"shapely>=2.0.0",
"tqdm>=4.48.2",
"pybboxes==0.1.6",
"pillow>=8.2.0",
"pyyaml",
"fire",
"terminaltables",
"requests",
"click",
"torch>=2.4.1",
]
[project.scripts]
sahi = "sahi.cli:app"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Install Commands
# Core install
pip install sahi
# With specific model backend
pip install sahi[ultralytics]
pip install sahi[yolov5]
pip install sahi[transformers]
pip install sahi[roboflow]
pip install sahi[mmdet]
pip install sahi[all]
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Core Dependencies | Python packages | Yes | opencv-python, shapely, tqdm, pybboxes, pillow, pyyaml, fire, terminaltables, requests, click, torch |
| Optional Extras | Python packages | No | Model-backend-specific packages (ultralytics, yolov5, transformers, etc.) |
Outputs
| Name | Type | Description |
|---|---|---|
| sahi package | Python package | Installable sahi library with CLI |
| sahi CLI | Console script | Command-line interface at sahi entry point |
Usage Examples
Installing with All Backends
# Install SAHI with all supported detection backends
pip install sahi[all]
# This installs: yolov5, ultralytics, torch, torchvision,
# transformers, inference, rfdetr, onnx, onnxruntime
Development Setup
# Clone and install with dev dependencies
git clone https://github.com/obss/sahi.git
cd sahi
pip install -e ".[dev]"