ST003: HasPyprojectToml
Overview
| Property | Value |
|---|---|
| ID | ST003 |
| Name | HasPyprojectToml |
| Group | structure |
| Severity | ERROR |
Description
Checks that a pyproject.toml file exists in the package root directory.
The pyproject.toml file is the modern standard for Python project configuration, defined in PEP 518 and PEP 621.
What it checks
The check verifies that pyproject.toml exists in the package root directory.
How to fix
Create a pyproject.toml file in your package root:
[project]
name = "my-package"
version = "0.1.0"
description = "A brief description of my package"
readme = "README.md"
license = "MIT"
requires-python = ">=3.11"
authors = [
{ name = "Your Name", email = "you@example.com" }
]
dependencies = [
"requests>=2.28.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"ruff>=0.8.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"Why pyproject.toml?
Benefits over legacy formats (setup.py, setup.cfg):
- Standardized - PEP 621 defines a common format
- Declarative - No executable code needed
- Tool configuration - Unified location for all tool configs
- Build isolation - Build dependencies are explicit
Configuration
Skip this check
[tool.pycmdcheck]
skip = ["ST003"]CLI
pycmdcheck --skip ST003