Skip to main content

Store and manage preferences easily.

Project description

PREFS

Store and manage preferences easily.

PREFS logo

Supported Python versions PREFS version Downloads Stars

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.

Installation

On Windows:
pip install PREFS

On MacOS and Linux:
pip3 install PREFS

Getting started

To initialize your preferences you will need to instance the Prefs class with the first argument as the default preferences (the ones used the first time the program runs or whenever the file gets deleted).

import prefs

default_prefs = {
  "lang": "en", 
  "theme": {
    "background": "#ffffff", 
    "font": "UbuntuMono", 
  }, 
}

my_prefs = prefs.Prefs(default_prefs)

The above code will create a file called prefs.prefs that looks like:

#PREFS
lang='en'
theme=>
  background='#ffffff' 
  font='UbuntuMono'

Then you can change values as if it were a dictionary.

my_prefs["lang"] = "es"

And now prefs.prefs will look like:

#PREFS
lang='es'
theme=>
  background='#ffffff'
  font='UbuntuMono'

You can write your own PREFS files manually as well, to manage your application's color scheme or the translations.


About

Contact me:

v1.0.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prefs-1.0.1.tar.gz (11.0 kB view hashes)

Uploaded source

Built Distribution

prefs-1.0.1-py3-none-any.whl (11.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page