CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-dynaconf

The dynamic configurator for your Python Project

Pending
Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Comprehensive CLI for project initialization, configuration management, validation, and debugging with support for multiple file formats and environments. The dynaconf CLI provides a powerful set of tools for managing configuration throughout the development lifecycle.

Capabilities

Project Initialization

Initialize new dynaconf projects with configuration templates and boilerplate.

# dynaconf init [OPTIONS]
# 
# Options:
#   --format TEXT         Configuration file format (toml, yaml, json, ini, py)
#   --path TEXT          Path to create the files (default: current directory)
#   --vars TEXT          Name for the main settings file (default: settings)
#   --secrets TEXT       Name for the secrets file (default: .secrets)
#   --wg / --no-wg       Generate .gitignore entries (default: --wg)
#   -y, --yes           Skip confirmation prompts
#   --django            Create Django-specific configuration

Usage examples:

# Initialize with TOML format (default)
dynaconf init

# Initialize with YAML format in specific directory
dynaconf init --format yaml --path ./config

# Initialize for Django project
dynaconf init --django --format yaml

# Initialize with custom file names
dynaconf init --vars config --secrets local_secrets

Value Retrieval

Get specific configuration values with formatting and type casting options.

# dynaconf get <key> [OPTIONS]
#
# Arguments:
#   key                  Configuration key to retrieve
#
# Options:
#   --default TEXT       Default value if key doesn't exist
#   --env TEXT          Environment to read from
#   --unparse           Show raw value without parsing

Usage examples:

# Get a simple value
dynaconf get DATABASE_URL

# Get with default value
dynaconf get PORT --default 8000

# Get from specific environment
dynaconf get DEBUG --env production

# Get raw unparsed value
dynaconf get TEMPLATE_STRING --unparse

Settings Inspection

List and inspect all configuration settings with detailed information.

# dynaconf list [OPTIONS]
#
# Options:
#   --env TEXT          Environment to list (default: current)
#   --key TEXT          Filter by specific key pattern
#   --more              Show more detailed information
#   --loader TEXT       Filter by loader source
#   --all               Show settings from all environments
#   --output TEXT       Output format (table, yaml, json)
#   --output-flat       Show flattened output
#   --json              Output as JSON

Usage examples:

# List all settings
dynaconf list

# List settings from specific environment
dynaconf list --env production

# List with detailed information
dynaconf list --more

# List specific key pattern
dynaconf list --key "DATABASE*"

# Export as JSON
dynaconf list --json

# Show all environments
dynaconf list --all

Configuration Export

Export settings to files or external services like Redis and Vault.

# dynaconf write <to> [OPTIONS]
#
# Arguments:
#   to                   Target (file path, redis://, vault://)
#
# Options:
#   --vars TEXT         Variable names to export (comma-separated)
#   --secrets TEXT      Export secrets separately
#   --path TEXT         Source path for settings
#   --env TEXT          Environment to export
#   -y, --yes          Skip confirmation prompts

Usage examples:

# Export to TOML file
dynaconf write settings_backup.toml

# Export to YAML with specific variables
dynaconf write config.yaml --vars "DATABASE_URL,API_KEY"

# Export to Redis
dynaconf write redis://localhost:6379/0

# Export to HashiCorp Vault
dynaconf write vault://localhost:8200/secret/myapp

# Export specific environment
dynaconf write prod_config.json --env production

Validation Runner

Run validation rules against configuration settings.

# dynaconf validate [OPTIONS]
#
# Options:
#   --path TEXT         Path to settings files

Usage examples:

# Run validation with default settings
dynaconf validate

# Run validation with custom settings path
dynaconf validate --path ./config/

Configuration Inspection

Inspect configuration loading history and debug settings resolution.

# dynaconf inspect [OPTIONS]
#
# Options:
#   --key TEXT          Inspect specific key
#   --env TEXT          Environment to inspect
#   --format TEXT       Output format (yaml, json, table)
#   --old-first         Show oldest entries first
#   --limit INTEGER     Limit number of entries
#   --all               Include internal settings
#   --report-mode       Show detailed report
#   --verbose           Verbose output

Usage examples:

# Inspect all settings loading
dynaconf inspect

# Inspect specific key
dynaconf inspect --key DATABASE_URL

# Inspect with verbose output
dynaconf inspect --verbose

# Generate detailed report
dynaconf inspect --report-mode

# Inspect specific environment
dynaconf inspect --env production

Global Options

Options available for all dynaconf commands.

# Global Options:
#   --instance/-i TEXT   Custom settings instance path
#   --version           Show version information
#   --docs              Open documentation in browser
#   --banner            Show dynaconf banner

Usage examples:

# Use custom settings instance
dynaconf --instance myapp.config.settings list

# Show version
dynaconf --version

# Open documentation
dynaconf --docs

# Show banner
dynaconf --banner

Supported Formats

Input Formats

  • toml - TOML configuration files
  • yaml - YAML configuration files
  • json - JSON configuration files
  • ini - INI configuration files
  • py - Python configuration files
  • env - Environment variable files (.env)

Output Formats

  • toml - Export to TOML files
  • yaml - Export to YAML files
  • json - Export to JSON files
  • ini - Export to INI files
  • py - Export to Python files
  • redis - Export to Redis database
  • vault - Export to HashiCorp Vault
  • env - Export to environment files

Integration Examples

CI/CD Pipeline Usage

# Validate configuration in CI
dynaconf validate --path ./deploy/

# Export production config
dynaconf write vault://prod-vault:8200/secret/app --env production

# Inspect configuration for debugging
dynaconf inspect --env staging --verbose

Development Workflow

# Initialize new project
dynaconf init --format yaml

# Check current settings during development
dynaconf list --env development --more

# Export settings for testing
dynaconf write test_config.json --env testing

# Validate before deployment
dynaconf validate

Install with Tessl CLI

npx tessl i tessl/pypi-dynaconf

docs

cli.md

core-configuration.md

error-handling.md

framework-integration.md

index.md

utilities.md

validation.md

tile.json