MT008: HasReadmeField
Overview
| Property | Value |
|---|---|
| ID | MT008 |
| Name | HasReadmeField |
| Group | metadata |
| Severity | WARNING |
Description
Checks that the [project].readme field is defined in pyproject.toml.
The readme field specifies which file contains your package’s long description:
- Displayed as the main content on your PyPI package page
- Provides detailed information about installation and usage
- Essential for user adoption and understanding
What it checks
The check verifies that pyproject.toml contains:
[project]
readme = "README.md"Or uses the expanded format:
[project]
readme = {file = "README.md", content-type = "text/markdown"}How to fix
Add the readme field to your pyproject.toml:
[project]
readme = "README.md"Supported formats
| Format | File extension | Content type |
|---|---|---|
| Markdown | .md |
text/markdown |
| reStructuredText | .rst |
text/x-rst |
| Plain text | .txt |
text/plain |
Explicit content type
For better compatibility, you can explicitly specify the content type:
[project]
readme = {file = "README.md", content-type = "text/markdown"}Multiple files
To combine multiple files:
[project.readme]
content-type = "text/markdown"
text = """
# My Package
See [README](https://github.com/user/project#readme) for full documentation.
"""Writing a good README
Your README should include:
- Project name and description - What does it do?
- Installation instructions - How to install
- Quick start / Usage - Basic example
- Documentation link - Where to learn more
- License - Usage terms
- Contributing - How to contribute
Example structure:
# My Package
Brief description of what the package does.
## Installation
pip install my-package
## Quick Start
from my_package import main
main()
## Documentation
Full documentation at https://my-package.readthedocs.io
## License
MIT LicenseConfiguration
Skip this check
[tool.pycmdcheck]
skip = ["MT008"]CLI
pycmdcheck --skip MT008