Store and manage preferences easily.
Project description
PREFS
Store and manage preferences easily.
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
- Docs: https://patitotective.github.io/PREFS/docs/start.
- GitHub: https://github.com/Patitotective/PREFS.
- Pypi: https://pypi.org/project/PREFS/.
- Discord: https://discord.gg/as85Q4GnR6.
Contact me:
- Discord: Patitotective#0127.
- Tiwtter: @patitotective.
- Email: cristobalriaga@gmail.com.
v1.0.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07bda70fe701eb0d4687547b10d69f0929b5436dd9ccad493bce406c782da704 |
|
MD5 | 5288e29f0709461d0539a4b87d23271d |
|
BLAKE2b-256 | 622c9d1fefea8afec951a61fb18dc8e0bb7a04ccf99d001b8ea1cbb21b7f0aec |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9989621a05d58ea58dc0f3705d6333ec0ba3c83e1fd0ec54bf4d97f1f7c15a1a |
|
MD5 | 397c346e6b930bbc4dee774a0d5be7d6 |
|
BLAKE2b-256 | bea2e928062fbffbc9e9593d6fe013470ebb9eac4f6fd96a23171f6e039c70b9 |