Skip to main content

A flexible configuration management library for Python with dot notation support, environment variable overrides, and more.

Project description

Vanisher

PyPI - Version PyPI - Downloads PyPI - Python Version

🔩 A flexible configuration management library for Python with dot notation support, environment variable overrides and more.

Features

  • JSON configuration file support
  • Dot notation for accessing nested values
  • Environment variable overrides
  • Type-safe getters
  • Dictionary-like interface
  • Import/export to JSON, YAML, and TOML
  • Deep merging of configurations
  • Easy configuration updates and persistence
  • Easy to use for both pros and beginners

Installation

pip install vanisher

Quick Start

import vanisher

config = vanisher.Vanisher("config.json")

config.set({
    "server.port": 8080,
    "debug": False,
    "database.user.name": "user"
})

config.get("server.port") # prints: 8080

Environment Variables

Environment variables automatically override config values when env_override=True (default). Keys are converted to UPPERCASE with underscores: database.hostDATABASE_HOST

Type-Safe Getters

config.get_int("port", 8080)    # Returns int
config.get_bool("debug", False) # Returns bool
config.get_list("allowed_ips")  # Returns list
config.get_dict("settings")     # Returns dict

Advanced Features

# List all config keys
keys = config.list_keys()

# Export config
json_str = config.export("json")
yaml_str = config.export("yaml")  # Requires PyYAML
toml_str = config.export("toml")  # Requires toml

# Import config
config.import_('{"key": "value"}')
config.import_({"key": "value"})

# Merge configurations
config.merge({"new": "data"})

License

vanisher is licensed under the MIT License. See the LICENSE file for more information.

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

wvanisher-1.0.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wvanisher-1.0.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file wvanisher-1.0.0.tar.gz.

File metadata

  • Download URL: wvanisher-1.0.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wvanisher-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3fa69fb0151815bba8ab52a825826c3ba7177444a3e87e4f8fc551574ff13e76
MD5 1af6e0a1d1e9e7f0d36f8e89757d6dfc
BLAKE2b-256 398de96891f28656aaa9b4c7c256e1f36fa22c276a0c0662a4c5677a9a4f52e4

See more details on using hashes here.

File details

Details for the file wvanisher-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wvanisher-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wvanisher-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b05712682019b85ffc963a4159d60e38dcd8c60ad8e5370f5d1e293839ceee4
MD5 927ad4dddc663ad0ca123b0218620f6f
BLAKE2b-256 4523ed7d9c4c324f1c5d55233fc5d48baa4ee47045de07bacb30292f250b9ceb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page