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
Release history Release notifications | RSS feed
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
File details
Details for the file pydantic_settings_export-0.3.4.tar.gz
.
File metadata
- Download URL: pydantic_settings_export-0.3.4.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8762ecd94856123563d02af2a5760a9ed27829558655f161ae77b82c3bf38c63 |
|
MD5 | 851fc64f5e435d81dd487b700cccc794 |
|
BLAKE2b-256 | e10ab60e30f941cc6193e5162049ff2d0a4afac69a0e7a5019a5d183a36d4b03 |
File details
Details for the file pydantic_settings_export-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: pydantic_settings_export-0.3.4-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 816ab5908138279eb654a8440faa48e569af0a083642ae8f989ee391353e29a8 |
|
MD5 | 7d23569e3193f1bb5bc3295bd7401332 |
|
BLAKE2b-256 | 4d932a936fdf2b48f178fb2b1dc15383599836ac8c4a8e07c9667a3c3e4a625c |