load and save settings from/ to a json file
Project description
json-sett
Read settings from and save them to a json file.
Requirements
- json-convenience
Install
install using pip: python -m pip install json-sett
Usage
- import the 'Settings' class:
from json_sett import Settings - initialize it:
my_settings = Settings(file=<your_file_path> - then access your settings as attributes of the 'my_settings' object:
say your json file contains the key 'settingA' you can access its value like that:my_settings.settingA - change the value of a setting like that:
my_settings.settingA = <your_new_value>
this will NOT save that value to the file - to save all settings use:
my_settings.save()
File restrictions
The settings must all be at the top level in the json file.
This is a valid example:
{
"settingA": "valueA",
"settingB": 14
}
This is an invalid example:
{
"settingA": "valueA",
"settingB": {
"settingC": true
}
}
Adding support for the invalid example e.g. being able to order settings in groups would be nice. Might do that some time.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json-sett-0.0.0.tar.gz.
File metadata
- Download URL: json-sett-0.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abe19f863d3e9bdbeba7e085b7e4a0627668cbaedd4f72ce91bef519fb093d84
|
|
| MD5 |
bb6e242860243cc047ad96b5a1b7a9a2
|
|
| BLAKE2b-256 |
aa0f53df73dea140a2b68bdde6d93670352f938a498595ec5b40397e5d52f326
|
File details
Details for the file json_sett-0.0.0-py3-none-any.whl.
File metadata
- Download URL: json_sett-0.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2bea33d546917ea29d65ae4d94d04be57bb062c72a2c5428f0405042b1904b
|
|
| MD5 |
7211cbcbb7712b7a63de4457e4d0d456
|
|
| BLAKE2b-256 |
71882977c134b070f7a90b571a6cf6c15dae512dbf24368170129ddd307d69ff
|