Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A library for parsing configuration files, including .env, .ini, .yaml, .json, .toml, and .xml formats.
_ _ _
| | ___ __ _ __| | __ _| |
| | / _ \ / _` |/ _` | \ \/ / |
| |__| (_) | (_| | (_| | > <| |
|_____\___/ \__,_|\__,_| /_/\_\_|
Configuration Parser Extraordinaire
load_xl
is a versatile Python library for parsing various configuration file formats, including .env
, .ini
, .yaml
, .json
, .toml
, and .xml
. It provides a unified interface for loading and validating configuration data, making it easy to work with different file formats in your projects.
┌─────────────────────────────────────────────┐
│ ⚙️ Multiple configuration file formats │
│ 🔄 Automatic environment variable substition │
│ 🛡️ JSON Schema validation │
│ 🔍 File watching for auto config reloading │
│ 🖥️ Command-line interface (CLI) │
│ 🐍 Compatible with Python 3.6+ │
└─────────────────────────────────────────────┘
Install load_xl
using pip:
pip install load_xl
from load_xl import load_config
# Load a configuration file
config = load_config('path/to/your/config.yaml')
# Load with schema validation
schema = {...} # Your JSON schema
config = load_config('path/to/your/config.json', schema=schema)
# Access configuration data
print(config['some_key'])
load_xl path/to/your/config.yaml --output
load_xl path/to/your/config.json --validate --schema path/to/schema.json
┌─────┬───────────────────────────────┐
│.env │ Environment variables │
│.ini │ INI configuration files │
│.yaml│ YAML configuration files │
│.json│ JSON configuration files │
│.toml│ TOML configuration files │
│.xml │ XML configuration files │
└─────┴───────────────────────────────┘
The load_xl
library includes a comprehensive test suite. You can find the test script in the test
directory. Here's a snippet of the test.py
file:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from load_xl import load_config, FileParsingError
# Test .env file parsing and loading
try:
print("\n[+] Loading .env file...")
env_config = load_config(".env")
print(env_config.get("TEST"))
print(env_config.get("TEST_ENV"))
except FileParsingError as e:
print(f"Error in parsing .env file: {e}")
# ... (tests for other file formats)
# Test .xml file parsing and returning as dict
try:
print("\n[+] Loading .xml file...")
xml_config = load_config("test.xml")
print(xml_config)
except FileParsingError as e:
print(f"Error in parsing .xml file: {e}")
To run the tests, navigate to the test
directory and execute:
python test.py
load_xl
automatically replaces ${VAR}
patterns in your configuration files with the corresponding environment variable values.
from load_xl import ConfigFileWatcher, YamlFileParser
watcher = ConfigFileWatcher('config.yaml', YamlFileParser)
watcher.start()
# Your application logic here
watcher.stop()
Note: There are example schema files provided in schemas folder.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
load_xl
For more information and updates, please visit the GitHub repository.
______________________________
< Thank you for using load_xl! >
------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
FAQs
A library for parsing configuration files, including .env, .ini, .yaml, .json, .toml, and .xml formats.
We found that load-xl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.