Skip to main content

Build-Settings

Build-Settings is an extension of the configparser library, designed to enhance its functionality by providing the ability to add, update, and refresh settings in real-time. It offers provisions for creating backups and securely storing credentials using environment variables.

Features

  • Real-time Settings Management: Build-Settings empowers users to dynamically add, update, and refresh settings without requiring manual intervention.

  • Backup Functionality: The library includes robust backup capabilities, ensuring that users can maintain the integrity of their configuration files and easily revert changes if necessary.

  • Secure Credential Storage: Build-Settings facilitates secure credential storage by offering support for environment variables, allowing sensitive information to be stored separately from configuration files.

Usage

Import and setup

import os
from settings import BuildSettings

setpath = os.path.abspath(os.path.join(os.path.dirname(__file__)))
settings = BuildSettings(setpath + '/tests_output.ini', setpath + '/tests.ini')

Add a setting

settings.add('test_setting_not_default', 'True')

Change the value of a setting

settings.set('string_setting', 'not_default')

Save settings

settings.save()

Reload settings

settings.load()

Upgrade settings merging new values from the defaults (this also happens on init)

settings.upgrade()

Clean extra settings from the running configuration that aren't present in defaults

settings.clean()

Settings within the [secure] section will be loaded directly into the environment and can only be retrieved using settings.get_secure("value") method

[settings]
string_setting = default_string
numeric_setting = 42
list_setting = [1, 2, 3]
tuple_setting = (4, 5, 6)
dict_setting = {'key1': 'value1', 'key2': [7, 8, 9], 'key3': (10, 11, 12)}
string_setting_2 = another_default_string
numeric_setting_2 = 100
list_setting_2 = [4, 5, 6]
tuple_setting_2 = (7, 8, 9)
dict_setting_2 = {'key3': 'value3', 'key4': {'inner_key1': 'inner_value1', 'inner_key2': [13, 14, 15]}}
nested_string_setting_3 = nested_default_string
nested_numeric_setting_3 = 999
nested_list_setting_3 = [7, 8, 9]
nested_tuple_setting_3 = (10, 11, 12)
nested_dict_setting_3 = {'key5': 'value5', 'key6': {'inner_key3': 'inner_value3', 'inner_key4': [16, 17, 18]}}
[secure]
password = '!@#$^&*'
private_key = 'age62gD5j6&gjwoifc?f385gwovS'
print('secure_value', settings.get_secure('private_key'))

Add or update a secure value (immediately loaded into the environment and saved to file)

settings.set_secure('key', 'value')

Backups are made when the settings file is changed, backups are not mode when the settings are default, empty, or are identical to the most recent backup.

Backups are restored when a backup is present and the settings file is missing, empty, or has reverted to defaults.

Installation

You can install Build-Settings via pip:

pip install build-settings

Getting Started

For detailed instructions on how to use Build-Settings, please refer to the documentation.

Support and Contributions

If you encounter any issues or have suggestions for improvement, please feel free to open an issue on GitHub. Contributions are also welcome, and pull requests will be reviewed promptly.

License

Build-Settings is licensed under the MIT License. See the LICENSE file for more information.

Metadata

Release files for build-settings 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for build-settings 0.1.7
File Size Uploaded
build-settings-0.1.7.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for build-settings 0.1.7
File Interpreter ABI Platform
build_settings-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / build-settings-0.1.7.tar.gz

Download URL build-settings-0.1.7.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cac8b68f09cf1d12b5b616b857837a0d747cc4e1f8a09b5d4c08add58fb990de
BLAKE2b-256 checksum
How to use checksums
4f19cbdcb64bb1777932f8b7227e7aac7b6fa312652a5e7406a53431dbc8fdb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / build_settings-0.1.7-py3-none-any.whl

Download URL build_settings-0.1.7-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c9b39e35e478f22481dfe5dcbde71b40abf4f215e1fae118f9f6032f6bad6c8
BLAKE2b-256 checksum
How to use checksums
d1f3b3fecbe7059575e125d0e770184a885b324286b186549a6713f9da0a79cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

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