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 wvanisher

Quick Start

import vanisher

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

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

port = config.get("server.port")

print(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

SERVER_PORT=8080
import vanisher

config = vanisher.Vanisher("config.json", env_overrides=True)
port = config.get("server.port")

print(port) # prints: 8080

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.4.tar.gz (55.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.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wvanisher-1.0.4.tar.gz
Algorithm Hash digest
SHA256 abbfd2e1f07013cc3849c3a3804d6cad122cb4ec4fb53a248f712ee46be44484
MD5 6f78c26b623658ad9e539ce8b794b668
BLAKE2b-256 611cdc20a06c1e703b4dcd267e67fc5afcf955720072c04914a2c62bf9a15004

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for wvanisher-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d2077d959ea1062a16d8141b6ffd5c6482db6b1d9cbc3e13c22e803bdbd78a75
MD5 54a6e0d41e2cc9a12fdc69e07080ee80
BLAKE2b-256 f11ff394153c002208abd92d38b4ffb2f4686e0a9819593ebd7796dabb44779b

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