Skip to content

niro4-1/config-parser

Repository files navigation

config-parser

A repository for parsing configuration files.

Features

  • Parses TOML, JSON, and YAML configuration files
  • Provides a unified interface for configuration management
  • Supports nested configuration structures

Installation

pip install config-parser

Usage

from config_parser import ConfigParser

config = ConfigParser()
config.load("config.toml")

# Access configuration values
print(config.get("database.host"))

Important Note on TOML Parsing

When loading TOML files, be aware that parse failures may occur silently. If a file contains errors, the ConfigParser will skip the problematic sections without raising an exception. Always validate the configuration after loading to ensure it is correct and handle any missing keys appropriately.

Additional Details on TOML Parsing

  • Error Handling: Implement error handling to catch and log any issues during parsing.
  • Validation: Consider adding a validation step after loading to check for required keys and expected data types.
  • Debugging: Use logging to output the loaded configuration and any skipped sections for easier debugging.

This ensures that users are aware of potential pitfalls and can handle them effectively.

About

Tiny library for parsing layered config files (TOML/YAML/env).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors