Implementation:Bentoml BentoML Project Configuration
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Build System, Configuration, Packaging |
| Last Updated | 2026-02-13 15:00 GMT |
Overview
The root pyproject.toml configuration file that defines the BentoML package metadata, dependencies, build system, optional extras, and tool configurations for linting, testing, type checking, and code coverage.
Description
This file is the single source of truth for the BentoML Python package configuration. It is structured into the following major sections:
- Project metadata (
[project]): Defines the package name (bentoml), description, license (Apache-2.0), authors, Python version requirement (>=3.9), keywords, and PyPI classifiers. The version is dynamic, derived from VCS (Git tags). - Dependencies: Lists approximately 40 core runtime dependencies including
pydantic,starlette,uvicorn,httpx,click,numpy,rich,opentelemetry-*instrumentation packages,cloudpickle,PyYAML,Jinja2,prometheus-client, and others. - Optional dependencies (
[project.optional-dependencies]): Defines extras groups:all,aws(S3 support),io(image/pandas I/O),triton,unsloth,grpc(with reflection and channelz sub-extras),tracing(Jaeger, Zipkin, OTLP), andmonitor-otlp. - Build system (
[build-system]): Useshatchlingas the build backend withhatch-vcsfor version management from Git tags. Configures version file generation atsrc/bentoml/_version.pyusing a post-release versioning scheme. - Package structure: The wheel includes four source packages:
src/bentoml,src/bentoml_cli,src/_bentoml_sdk, andsrc/_bentoml_impl. - Entry points (
[project.scripts]): Registers thebentomlCLI command pointing tobentoml_cli.cli:cli. - Tool configurations:
- Ruff (
[tool.ruff]): Linting and formatting with line length 88, Python 3.10 target, isort integration, ignoring E501, and Google-style docstrings. - Pytest (
[tool.pytest.ini_options]): Test configuration with custom plugin (bentoml.testing.pytest.plugin) and test paths intests/. - Coverage (
[tool.coverage]): Branch coverage with specific omissions for generated gRPC code, testing utilities, and other non-critical paths. - Pyright (
[tool.pyright]): Strict type checking with Python 3.12 target, comprehensive error reporting settings, and exclusions for generated protobuf files.
- Ruff (
- Dependency groups (
[dependency-groups]): Definesdocs(Sphinx and related),tooling(pre-commit, nox), andtesting(pytest, coverage, scikit-learn) groups.
Usage
This file is consumed by build tools (pip install, hatch build), linters (ruff), type checkers (pyright), test runners (pytest), and CI/CD pipelines. Developers modify it to update dependencies, adjust tool settings, or change package metadata.
Code Reference
Source Location
- Repository: Bentoml_BentoML
- File: pyproject.toml
- Lines: 1-340
Signature
[project]
name = "bentoml"
requires-python = ">=3.9"
license = { text = "Apache-2.0" }
dynamic = ["version"]
[build-system]
requires = ['hatchling', "hatch-vcs>=0.3.0"]
build-backend = 'hatchling.build'
[project.scripts]
bentoml = "bentoml_cli.cli:cli"
Import
# Install from source with all extras
pip install -e ".[all]"
# Install with specific extras
pip install "bentoml[grpc,tracing,io]"
# Build the package
hatch build
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Git tags | VCS tags | Yes | Used by hatch-vcs to derive the package version dynamically |
| Source packages | Python source | Yes | src/bentoml, src/bentoml_cli, src/_bentoml_sdk, src/_bentoml_impl
|
Outputs
| Name | Type | Description |
|---|---|---|
| bentoml package | Python wheel/sdist | Built distribution package with metadata and dependencies |
| bentoml CLI | Console script | bentoml command registered as entry point
|
| _version.py | Python file | Auto-generated version file at src/bentoml/_version.py
|
Usage Examples
# Install BentoML in development mode
pip install -e ".[all]"
# Run linting
ruff check src/
# Run type checking
pyright
# Run tests
pytest tests/
# Build distribution
hatch build
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment