Export your Pydantic settings to a Markdown and .env.example files!
Project description
pydantic-settings-export
Export your Pydantic settings to Markdown and .env.example files!
This package provides a way to use pydantic (and pydantic-settings) models to generate a Markdown file with the settings and their descriptions, and a .env.example
file with the settings and their default values.
Installation
pip install pydantic-settings-export
# or
pipx install pydantic-settings-export # for a global installation and using as a CLI
# or
uv tool install pydantic-settings-export
Usage
You can see the usage examples of this package in the ./docs/Configuration.md and .env.example.
As code
from pydantic import BaseSettings
from pydantic_settings_export import Exporter, MarkdownSettings, Settings as PSESettings
class Settings(BaseSettings):
my_setting: str = "default value"
another_setting: int = 42
# Export the settings to a Markdown file `docs/Configuration.md` and `.env.example` file
Exporter(
PSESettings(
markdown=MarkdownSettings(
save_dirs=["docs"],
),
),
).run_all(Settings)
As CLI
pydantic-settings-export --help
Configuration
You can add a pydantic_settings_export
section to your pyproject.toml
file to configure the exporter.
[tool.pydantic_settings_export]
project_dir = "."
default_settings = [
"pydantic_settings_export.settings:Settings",
]
dotenv = { "name" = ".env.example" }
[tool.pydantic_settings_export.markdown]
name = "Configuration.md"
save_dirs = [
"docs",
"wiki",
]
Todo
- Add tests
- Add more configuration options
- Add more output formats
- TOML (and
pyproject.toml
) - JSON
- YAML
- TOML (and
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pydantic_settings_export-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff199da935b0f37f152e6a3bb3ad73429a71cace748a5e0d75317873a0d289b8 |
|
MD5 | c634849682c69fca09109de2634c1175 |
|
BLAKE2b-256 | 31f81be85d2088c0dd728642d929ab3dd6fb7ef7305b136c3c5e83dba5fedef4 |
Close
Hashes for pydantic_settings_export-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fba0960b4fb3d8753c7d1ae0ab8ec294a36821042902c1319af2fd5bf9329ad |
|
MD5 | ec38d98b993b4712012f092ebcacf061 |
|
BLAKE2b-256 | 76a47f819b80f3cfb6e33ca0a1f05fe05c8f94a51442954905c76cd874d07f64 |