Skip to main content
PREFS logo

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

What is PREFS?

PREFS is a Python library that facilitate the process of store and manage user preferences, simple but useful.

How does PREFS work?

In a nutshell what PREFS does is search for a PREFS file with the given name and if not found create it with the default PREFS.

Installation:

On windows: pip install PREFS

On MacOS and Linux: pip3 install PREFS

Syntax:

Each PREFS file is an instance of the PREFS class:
PREFS class has one required parameter, which is a dictionary with the default preferences, default means the preferences that all users will have at first time.

UserPrefs = PREFS.PREFS(prefs = {
  "theme": "light", 
  "lang": "en", 
  "keybindings": {"Ctrl+C": "Copy", "Ctrl+V": "Paste", "Ctrl+X": "Cut"}
})

This code will create a file like this:

#PREFS
theme=light
lang=en
keybindings=>
  Ctrl+C=Copy
  Ctrl+V=Paste
  Ctrl+X=Cut

A total human readable file that supports cascade/tree in nested dictionaries.


The main methods to manage the preferences are are:

  • ReadPrefs(): Returns a dictionary reading the PREFS file.

  • WritePrefs(): Requires two arguments, first the name of the pref that you want to change (if pref exists) or create if it doesn't, and second argument is the value that you want to assign to the pref. If using nested dictionaries pass in key parameter the keys path separated by a forward slash, e.g.: WritePrefs("keybindings/Ctr+C", "Ctrl+D")

  • ConvertToJson(): Converts the PREFS file into a json one.

Methods outside PREFS class:

  • ReadJsonFile(): Requires a the filename of the json file to read and returns it's value.

  • ReadPREFSFile(): Given the filename of a PREFS file reads it and returns it's value.

Documentation

PREFS documentation can be found at https://prefs-documentation.readthedocs.io with more examples and information.


Links

v0.1.8

Download files

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

Source Distribution

PREFS-0.1.8.tar.gz (13.1 kB view details)

Uploaded Source

File details

Details for the file PREFS-0.1.8.tar.gz.

File metadata

  • Download URL: PREFS-0.1.8.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for PREFS-0.1.8.tar.gz
Algorithm Hash digest
SHA256 0050a6b794a255014aa112e93d2b9714b784b22ae88eb0d1122dfcef177de8b0
MD5 2a7be25ae7d44bafaa93672a2605e46d
BLAKE2b-256 9fd23f0c3b711201c4bf8590193395d0a748f21bbf8456250ce74e6d5726c270

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

1.0.0

2 files

0.2.65

1 file

0.2.60

1 file

0.2.56

1 file

0.2.51

1 file

0.2.50

1 file

0.2

1 file

0.1.99

1 file

0.1.98

1 file

0.1.91

1 file

0.1.9

1 file

This release

0.1.8 This release

1 file

0.1.7

1 file

0.1.6

1 file

0.1.4

1 file

0.1.3

1 file

0.1.1

1 file

0.1.0

1 file

0.0.99

1 file

0.0.92

1 file

0.0.87

1 file

0.0.86

1 file

0.0.85

1 file

0.0.81

1 file

0.0.80

1 file

0.0.75

1 file

0.0.74

1 file

0.0.73

1 file

0.0.72

1 file

0.0.71

1 file

0.0.70

1 file

0.0.65

1 file

0.0.60

1 file

0.0.52

1 file

0.0.51

1 file

0.0.49

1 file

0.0.48

1 file

0.0.47

1 file

0.0.46

1 file

0.0.45

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page