Skip to main content

PREFS logo

Supported Python versions PREFS version Downloads Stars Watchers

Build Last commit Size License MIT

Made with Python Discord server

PREFS is Python library that stores preferences in a text file with a dictionary-like structure.

Features

Limitations

  • Keys can only be strings.
  • The supported types are int, float, str, list, tuple, set, dict, bytes and ranges.

Example

import prefs

default_prefs = {
"lang": "en",
"theme": "dark",
"scheme": {
"background-color": "#AB2E6A",
"font": {
"color": "#129396",
"size": 15
"family": "UbuntuMono"
}
}
}

my_prefs = prefs.Prefs(default_prefs, path="settings.prefs")
print(my_prefs["scheme/font/size"])
>>> 15

my_prefs["scheme/font/size"] = 20
my_prefs.pop("theme")

A new file got created that looks like:

settings.prefs
#PREFS
lang='en'
scheme=>
background-color='#AB2E6A'
font=>
color='#129396'
size=20
family='UbuntuMono'
v1.0.0