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.1.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.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wvanisher-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 0d13b26086c2fc123454ad91fe7df9d52c10216eb4540633143a56dbdf173b60
MD5 1b035c27e9847a32d472113e2572fb64
BLAKE2b-256 598ef31b925338111ba6158b114b6d1da0c053aa0538c922f8cbfc2251dda1d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wvanisher-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9af2ebb2b0e8d299ee157a81608005226aacec890f6181fab647bd21c240b889
MD5 e4a691bea4f2d9bcf5e131c5071a5fde
BLAKE2b-256 b8fe1ec97d5775628e137b942dd115b508a1641d81b0db7c2c966c5e6ed0da30

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