A Python library for managing configurations. Supports saving and loading configurations in various formats, such as JSON, YAML, XML, INI, and CFG.
To install the library, you can use pip:
pip install ConfigSetup
To use the ConfigSetup library in your Python code, you can import it and create an instance of the ConfigSetup
class:
from config_setup import ConfigSetup
config = ConfigSetup()
To set a value in the configuration, you can use the set
method:
config.set('name', 'John')
To get a value from the configuration, you can use the get
method:
name = config.get('name')
To save the configuration to a file, you can use the save
method and specify the file format:
config.save('config', 'json')
To load a configuration from a file, you can use the load
method and specify the file path:
config.load('config.json')
To validate a configuration data string against a specific format, you can use the validate
method and specify the format:
data = '{"name": "John", "age": 30}'
valid = config.validate(data, 'json')
To clear the configuration, you can use the clear
method:
config.clear()
This library is released under the MIT License.
Contributions are always welcome! If you'd like to contribute to this library, please follow these steps:
- Fork the project on GitHub.
- Clone your forked repository to your local machine.
- Create a new branch for your changes.
- Make your changes and commit them, making sure to write clear commit messages.
- Push your branch to your forked repository.
- Submit a pull request to the main project repository, explaining your changes and why they should be merged.
Before submitting a pull request, please make sure to run the tests by executing the following command from the project's root directory:
python -m unittest discover
If any tests fail, please investigate and fix the issue before submitting your pull request.
Thank you for your interest in contributing to this project!