_ _ _
| | ___ __ _ __| | __ _| |
| | / _ \ / _` |/ _` | \ \/ / |
| |__| (_) | (_| | (_| | > <| |
|_____\___/ \__,_|\__,_| /_/\_\_|
Configuration Parser Extraordinaire
load_xl
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.
✨ Features
┌─────────────────────────────────────────────┐
│ ⚙️ 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+ │
└─────────────────────────────────────────────┘
🚀 Installation
Install load_xl using pip:
pip install load_xl
💻 Usage
As a Library
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'])
Command-line Interface
load_xl path/to/your/config.yaml --output
load_xl path/to/your/config.json --validate --schema path/to/schema.json
📁 Supported File Formats
┌─────┬───────────────────────────────┐
│.env │ Environment variables │
│.ini │ INI configuration files │
│.yaml│ YAML configuration files │
│.json│ JSON configuration files │
│.toml│ TOML configuration files │
│.xml │ XML configuration files │
└─────┴───────────────────────────────┘
🔬 Testing
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
🔧 Advanced Features
Environment Variable Substitution
load_xl automatically replaces ${VAR} patterns in your configuration files with the corresponding environment variable values.
File Watching
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.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
- sc4rfurry - GitHub
🙏 Acknowledgments
- Thanks to all contributors and users of
load_xl - Inspired by the need for a unified configuration parsing solution
- This project was developed with some assistance from ChatGPT 4.0 , showcasing the potential of AI-assisted coding and for my peronal experience too
For more information and updates, please visit the GitHub repository.
______________________________
< Thank you for using load_xl! >
------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Metadata
Release files for load-xl 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| load_xl-1.0.1.tar.gz | 8.0 kB | Without provenance | Details for load_xl-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| load_xl-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for load_xl-1.0.1-py3-none-any.whl |
Total release size: 15.2 kB
Release files / load_xl-1.0.1.tar.gz
| Download URL | load_xl-1.0.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a90227d8e0ec743dc92c3260d7580ef37750975a6d518cae7b12555da77114e
|
|
BLAKE2b-256 checksum How to use checksums |
c32dbb68e4a62dc11d2e2da52bc037cd725f6f57c4a91e916001ebe797faa751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / load_xl-1.0.1-py3-none-any.whl
| Download URL | load_xl-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc4d5b656ec900b32e04bcb4c0d09e394b2f208a63a2f299b15a8cca97bc7679
|
|
BLAKE2b-256 checksum How to use checksums |
0e06dd4e8c1312250ca23b1081cfb33569d459a218d3ff5a7dde4d49e31af044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for load-xl 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.