```
_ _ _
| | ___ __ _ __| | __ _| |
| | / _ \ / _` |/ _` | \ \/ / |
| |__| (_) | (_| | (_| | > <| |
|_____\___/ \__,_|\__,_| /_/\_\_|
Configuration Parser Extraordinaire
```
# load_xl
[![PyPI version](https://badge.fury.io/py/load-xl.svg)](https://badge.fury.io/py/load-xl)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Versions](https://img.shields.io/pypi/pyversions/load-xl.svg)](https://pypi.org/project/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:
```bash
pip install load_xl
```
## 💻 Usage
### As a Library
```python
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
```bash
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:
```python
#!/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:
```bash
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
```python
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](LICENSE) file for details.
## 👨💻 Author
- **sc4rfurry** - [GitHub](https://github.com/sc4rfurry)
## 🙏 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](https://github.com/sc4rfurry/load_xl).
```
______________________________
< Thank you for using load_xl! >
------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sc4rfurry/load_xl",
"name": "load-xl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "config, configuration, parser, env, ini, yaml, json, toml, xml",
"author": "sc4rfurry",
"author_email": "akalucifr@protonmail.ch",
"download_url": "https://files.pythonhosted.org/packages/c3/2d/bb68e4a62dc11d2e2da52bc037cd725f6f57c4a91e916001ebe797faa751/load_xl-1.0.1.tar.gz",
"platform": null,
"description": "```\r\n _ _ _\r\n| | ___ __ _ __| | __ _| |\r\n| | / _ \\ / _` |/ _` | \\ \\/ / |\r\n| |__| (_) | (_| | (_| | > <| |\r\n|_____\\___/ \\__,_|\\__,_| /_/\\_\\_|\r\n\r\n Configuration Parser Extraordinaire\r\n```\r\n\r\n# load_xl\r\n\r\n[![PyPI version](https://badge.fury.io/py/load-xl.svg)](https://badge.fury.io/py/load-xl)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n[![Python Versions](https://img.shields.io/pypi/pyversions/load-xl.svg)](https://pypi.org/project/load-xl/)\r\n\r\n`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.\r\n\r\n## \u2728 Features\r\n\r\n```\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502 \u2699\ufe0f Multiple configuration file formats \u2502\r\n\u2502 \ud83d\udd04 Automatic environment variable substition \u2502\r\n\u2502 \ud83d\udee1\ufe0f JSON Schema validation \u2502\r\n\u2502 \ud83d\udd0d File watching for auto config reloading \u2502\r\n\u2502 \ud83d\udda5\ufe0f Command-line interface (CLI) \u2502\r\n\u2502 \ud83d\udc0d Compatible with Python 3.6+ \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n```\r\n\r\n## \ud83d\ude80 Installation\r\n\r\nInstall `load_xl` using pip:\r\n\r\n```bash\r\npip install load_xl\r\n```\r\n\r\n## \ud83d\udcbb Usage\r\n\r\n### As a Library\r\n\r\n```python\r\nfrom load_xl import load_config\r\n\r\n# Load a configuration file\r\nconfig = load_config('path/to/your/config.yaml')\r\n\r\n# Load with schema validation\r\nschema = {...} # Your JSON schema\r\nconfig = load_config('path/to/your/config.json', schema=schema)\r\n\r\n# Access configuration data\r\nprint(config['some_key'])\r\n```\r\n\r\n### Command-line Interface\r\n\r\n```bash\r\nload_xl path/to/your/config.yaml --output\r\nload_xl path/to/your/config.json --validate --schema path/to/schema.json\r\n```\r\n\r\n## \ud83d\udcc1 Supported File Formats\r\n\r\n```\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502.env \u2502 Environment variables \u2502\r\n\u2502.ini \u2502 INI configuration files \u2502\r\n\u2502.yaml\u2502 YAML configuration files \u2502\r\n\u2502.json\u2502 JSON configuration files \u2502\r\n\u2502.toml\u2502 TOML configuration files \u2502\r\n\u2502.xml \u2502 XML configuration files \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n```\r\n\r\n## \ud83d\udd2c Testing\r\n\r\nThe `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:\r\n\r\n```python\r\n#!/usr/bin/env python3\r\n# -*- coding: utf-8 -*-\r\nfrom load_xl import load_config, FileParsingError\r\n\r\n# Test .env file parsing and loading\r\ntry:\r\n print(\"\\n[+] Loading .env file...\")\r\n env_config = load_config(\".env\")\r\n print(env_config.get(\"TEST\"))\r\n print(env_config.get(\"TEST_ENV\"))\r\nexcept FileParsingError as e:\r\n print(f\"Error in parsing .env file: {e}\")\r\n\r\n# ... (tests for other file formats)\r\n\r\n# Test .xml file parsing and returning as dict\r\ntry:\r\n print(\"\\n[+] Loading .xml file...\")\r\n xml_config = load_config(\"test.xml\")\r\n print(xml_config)\r\nexcept FileParsingError as e:\r\n print(f\"Error in parsing .xml file: {e}\")\r\n```\r\n\r\nTo run the tests, navigate to the `test` directory and execute:\r\n\r\n```bash\r\npython test.py\r\n```\r\n\r\n## \ud83d\udd27 Advanced Features\r\n\r\n### Environment Variable Substitution\r\n\r\n`load_xl` automatically replaces `${VAR}` patterns in your configuration files with the corresponding environment variable values.\r\n\r\n### File Watching\r\n\r\n```python\r\nfrom load_xl import ConfigFileWatcher, YamlFileParser\r\n\r\nwatcher = ConfigFileWatcher('config.yaml', YamlFileParser)\r\nwatcher.start()\r\n\r\n# Your application logic here\r\n\r\nwatcher.stop()\r\n```\r\n##\r\n\r\n> **Note:** There are example schema files provided in **schemas** folder.\r\n##\r\n\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n## \ud83d\udcdc License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83d\udc68\u200d\ud83d\udcbb Author\r\n\r\n- **sc4rfurry** - [GitHub](https://github.com/sc4rfurry)\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\n- Thanks to all contributors and users of `load_xl`\r\n- Inspired by the need for a unified configuration parsing solution\r\n- This project was developed with some assistance from **ChatGPT 4.0** , showcasing the potential of AI-assisted coding and for my peronal experience too\r\n\r\n---\r\n\r\nFor more information and updates, please visit the [GitHub repository](https://github.com/sc4rfurry/load_xl).\r\n\r\n```\r\n ______________________________\r\n< Thank you for using load_xl! >\r\n ------------------------------\r\n \\ ^__^\r\n \\ (oo)\\_______\r\n (__)\\ )\\/\\\r\n ||----w |\r\n || ||\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A library for parsing configuration files, including .env, .ini, .yaml, .json, .toml, and .xml formats.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/sc4rfurry/load_xl"
},
"split_keywords": [
"config",
" configuration",
" parser",
" env",
" ini",
" yaml",
" json",
" toml",
" xml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e06dd4e8c1312250ca23b1081cfb33569d459a218d3ff5a7dde4d49e31af044",
"md5": "f48086d46320041e5ea53f549bb8bf9e",
"sha256": "cc4d5b656ec900b32e04bcb4c0d09e394b2f208a63a2f299b15a8cca97bc7679"
},
"downloads": -1,
"filename": "load_xl-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f48086d46320041e5ea53f549bb8bf9e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7206,
"upload_time": "2024-09-14T15:53:32",
"upload_time_iso_8601": "2024-09-14T15:53:32.614562Z",
"url": "https://files.pythonhosted.org/packages/0e/06/dd4e8c1312250ca23b1081cfb33569d459a218d3ff5a7dde4d49e31af044/load_xl-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c32dbb68e4a62dc11d2e2da52bc037cd725f6f57c4a91e916001ebe797faa751",
"md5": "35ae11817ef7179caac73680a7b4aa4b",
"sha256": "2a90227d8e0ec743dc92c3260d7580ef37750975a6d518cae7b12555da77114e"
},
"downloads": -1,
"filename": "load_xl-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "35ae11817ef7179caac73680a7b4aa4b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7986,
"upload_time": "2024-09-14T15:53:33",
"upload_time_iso_8601": "2024-09-14T15:53:33.719137Z",
"url": "https://files.pythonhosted.org/packages/c3/2d/bb68e4a62dc11d2e2da52bc037cd725f6f57c4a91e916001ebe797faa751/load_xl-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-14 15:53:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sc4rfurry",
"github_project": "load_xl",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "load-xl"
}