Principle:Obss Sahi Project Configuration
| Knowledge Sources | |
|---|---|
| Domains | Packaging, Configuration |
| Last Updated | 2026-02-08 12:00 GMT |
Overview
Design pattern for declaring Python project metadata, dependencies, and tooling configuration in a centralized build file.
Description
Project Configuration is the practice of declaring all package metadata (name, version, license), runtime dependencies, optional dependency groups for different feature sets, CLI entry points, and development tooling settings (linter, formatter, test runner) in a single pyproject.toml file following PEP 621 standards. This centralizes all build and environment information, enabling reproducible installs and consistent development workflows.
Usage
Apply this principle when setting up a Python package that needs to support multiple optional dependency combinations (e.g., different detection backends) and must declare CLI entry points, linting rules, and build system configuration in a single authoritative source.
Theoretical Basis
The principle follows PEP 621 (storing project metadata in pyproject.toml) and PEP 517/518 (build system declaration). The key design decisions are:
- Core vs Optional dependencies: Separate always-required packages from backend-specific ones using optional-dependencies groups
- Entry points: Register CLI commands via [project.scripts] for automatic console script generation
- Tool unification: Consolidate linter, formatter, and test settings in [tool.*] sections