PREFS
PREFS is a Python library to store and manage preferences and settings.
PREFS stores a Python dictionary in a total human-readable file, the PREFS file is created when it can't find it (normally the first time you run the program), otherwise if the file already exists it just read it's content.
Installation:
On windows: pip install PREFS
On MacOS and Linux: pip3 install PREFS
Syntax:
Each PREFS file is an instance of the PREFS
class:
The PREFS
class has one required parameter, which is a dictionary with the default preferences (used to create the file when it can't it).
default_prefs = {
"theme": "light",
"lang": "en",
"keybindings": {"Ctrl+C": "Copy", "Ctrl+V": "Paste", "Ctrl+X": "Cut"}
}
user_prefs = PREFS.Prefs(default_prefs)
This code will create a file like this:
#PREFS
theme='light'
lang='en'
keybindings=>
Ctrl+C='Copy'
Ctrl+V='Paste'
Ctrl+X='Cut'
A total human readable file that supports cascade/tree in nested dictionaries.
Other functions
read_json_file()
.read_yaml_file()
.read_prefs_file()
.convert_to_prefs()
.
Documentation
PREFS documentation can be found at https://patitotective.github.io/PREFS/docs/ with more examples and information.
About
-
GitHub page: https://github.com/Patitotective/PREFS.
-
Pypi page: https://pypi.org/project/PREFS/.
-
Contact me:
- Discord: Patitotective#0127.
- Email: [email protected].
v0.2.65