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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file prefs-1.0.1.tar.gz.

File metadata

  • Download URL: prefs-1.0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.6.10-050610-generic

File hashes

Hashes for prefs-1.0.1.tar.gz
Algorithm Hash digest
SHA256 07bda70fe701eb0d4687547b10d69f0929b5436dd9ccad493bce406c782da704
MD5 5288e29f0709461d0539a4b87d23271d
BLAKE2b-256 622c9d1fefea8afec951a61fb18dc8e0bb7a04ccf99d001b8ea1cbb21b7f0aec

See more details on using hashes here.

File details

Details for the file prefs-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: prefs-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.6.10-050610-generic

File hashes

Hashes for prefs-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9989621a05d58ea58dc0f3705d6333ec0ba3c83e1fd0ec54bf4d97f1f7c15a1a
MD5 397c346e6b930bbc4dee774a0d5be7d6
BLAKE2b-256 bea2e928062fbffbc9e9593d6fe013470ebb9eac4f6fd96a23171f6e039c70b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page