Skip to main content

Python library to manage application user settings

Project description

UserConf

Python library to manage application user settings

Introduction

This library allows you to write and read key-value settings for a Python application in a JSON file inside the home directory of the user who is running the application.

Usage example

import userconf as uc

# Set the working application ID. The JSON file containing the settings will be
# saved in a directory which name is the dot character "." followed by the ID
# provided when calling the following function. This directory will be created
# inside the user's home directory.
uc.set_application_id("exampleapp")

# Write a setting value. This is done by providing its ID and value. The value
# can be any JSON serializable object (e.g. a string, a list, a dictionary...).
uc.set_setting_value("setting_example", "Example value")

# Read a setting value. This is done by providing its ID and an optional
# default value that will be returned if the setting doesn't exist.
v = uc.get_setting_value("setting_example", "Default value")

Function list

get_application_id()
set_application_id(id)
get_all_setting_ids()
setting_exists(id)
get_setting_value(id, default_value = None)
set_setting_value(id, value)
clear_setting(id)
clear_all_settings()

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

userconf-0.2.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

userconf-0.2.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

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