Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Obss Sahi Pyproject Configuration

From Leeroopedia
Revision as of 16:05, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Obss_Sahi_Pyproject_Configuration.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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

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]"

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment