-
Notifications
You must be signed in to change notification settings - Fork 2
Generators
This document describes all available generators and their configuration options in pydantic-settings-export.
Generators are the core components responsible for creating documentation from your Pydantic settings. Each generator:
- Has 8000 a unique name and purpose
- Implements specific formatting rules
- Handles nested settings gracefully
- Supports custom configuration
- Produces consistent output
The generator system is extensible, allowing you to create custom generators for your specific needs.
The Markdown generator creates formatted documentation with tables and sections.
Keyword: markdown
Class: MarkdownGenerator
or pydantic_settings_export.generators.MarkdownGenerator
- Customizable table headers
- Support for nested settings
- Environment variable prefixes
- Optional region-based content insertion
- Markdown formatting with headers and sections
[[tool.pydantic_settings_export.generators.markdown]]
# Output file paths
paths = [
"docs/settings.md",
"wiki/configuration"
]
# Document formatting
table_headers = ["Name", "Type", "Default", "Description"] # Optional headers
table_only = false # Generate full documentation with headers
file_prefix = "# Application Settings\n\n" # Optional prefix text
# Advanced options
to_upper_case = true # Convert field names to uppercase
region = false # Region for content insertion (requires 'regions' extra)
The DotEnv generator creates .env
example files with environment variables.
Keyword: dotenv
Class: DotEnvGenerator
or pydantic_settings_export.generators.DotEnvGenerator
- Multiple export modes
- Optional grouping by settings class
- Example value inclusion
- Support for aliases
- Comment-based documentation
[[tool.pydantic_settings_export.generators.dotenv]]
# Output file paths
paths = [
".env.example",
".env.sample"
]
# Generation options
split_by_group = true # Group variables by settings class
add_examples = true # Include example values
mode = "all" # Export mode: "all", "only-optional", or "only-required"
The Simple generator creates plain text documentation with basic formatting.
Keyword: simple
Class: SimpleGenerator
or pydantic_settings_export.generators.SimpleGenerator
- Basic text formatting
- Section headers with underlines
- Field descriptions
- Default values
- Example inclusion
[[tool.pydantic_settings_export.generators.simple]]
# Output file paths
paths = [
"docs/simple-settings.txt"
]
# The Simple generator has minimal configuration
enabled = true # Enable/disable generation
-
File Organization
- Use consistent file paths
- Group related settings files
- Use descriptive file names
-
Configuration
- Keep configuration in pyproject.toml
- Use environment variables for sensitive values
- Document generator options
-
Generation
- Test output with different settings types
- Validate generated documentation
- Keep formatting consistent
For common issues and solutions, see Troubleshooting.