Skip to main content
PREFS logoPREFS logo

Python Version PYPI Downloads Stars Watchers
Build Last commit Size Top languages License MIT
Made with python

PREFS is a Python library to manage and store user preferences for your program, application or game.
It stores a Python dictionary in a total human-readable file, you need to pass to it a default prefs that will be used when there are no preferences.

Features

Limitations

  • Keys can only be strings.
  • The supported types are Python default ones (int, float, str, list, tuple, set, dict, etc.).

Example

import PREFS

default_prefs = {
"theme": "light",
"lang": "en",
"keybindings": {
"Ctrl+D": "Duplicate",
"Ctrl+C": "Copy",
"Ctr+V": "Paste",
"Ctrl+X": "Cut",
"Ctrl+Q": "Quit"
}
}

user_prefs = PREFS.Prefs(default_prefs, filename="settings.prefs")

Result:

settings.prefs
#PREFS
theme="light"
lang="en"
keybindings=>
Ctrl+D="Duplicate"
Ctrl+C="Copy"
Ctrl+V="Paste"
Ctrl+X="Cut"
Ctrl+Q="Quit"