# 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:
```json
{
"settingA": "valueA",
"settingB": 14
}
```
This is an invalid example:
```json
{
"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.
Raw data
{
"_id": null,
"home_page": "https://github.com/Schnilsibus/json_sett.git",
"name": "json-sett",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "json,settings",
"author": "Nils Urbach",
"author_email": "ndu01u@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/aa/0f/53df73dea140a2b68bdde6d93670352f938a498595ec5b40397e5d52f326/json-sett-0.0.0.tar.gz",
"platform": null,
"description": "# json-sett\r\nRead settings from and save them to a json file.\r\n\r\n## Requirements\r\n- json-convenience\r\n\r\n## Install\r\ninstall using pip: ```python -m pip install json-sett```\r\n\r\n## Usage\r\n- import the 'Settings' class: ```from json_sett import Settings``` \r\n- initialize it: ```my_settings = Settings(file=<your_file_path>``` \r\n- then access your settings as attributes of the 'my_settings' object: \r\n say your json file contains the key 'settingA' you can access its value like that: ```my_settings.settingA```\r\n- change the value of a setting like that: ```my_settings.settingA = <your_new_value>``` \r\n this will NOT save that value to the file\r\n- to save all settings use: ```my_settings.save()```\r\n\r\n## File restrictions\r\nThe settings must all be at the top level in the json file. \r\nThis is a valid example:\r\n```json\r\n{\r\n \"settingA\": \"valueA\",\r\n \"settingB\": 14\r\n}\r\n```\r\nThis is an invalid example:\r\n```json\r\n{\r\n \"settingA\": \"valueA\",\r\n \"settingB\": {\r\n \"settingC\": true\r\n }\r\n}\r\n```\r\nAdding support for the invalid example e.g. being able to order settings in groups would be nice.\r\nMight do that some time.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "load and save settings from/ to a json file",
"version": "0.0.0",
"project_urls": {
"Homepage": "https://github.com/Schnilsibus/json_sett.git"
},
"split_keywords": [
"json",
"settings"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "71882977c134b070f7a90b571a6cf6c15dae512dbf24368170129ddd307d69ff",
"md5": "7211cbcbb7712b7a63de4457e4d0d456",
"sha256": "8c2bea33d546917ea29d65ae4d94d04be57bb062c72a2c5428f0405042b1904b"
},
"downloads": -1,
"filename": "json_sett-0.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7211cbcbb7712b7a63de4457e4d0d456",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3461,
"upload_time": "2023-10-08T20:55:13",
"upload_time_iso_8601": "2023-10-08T20:55:13.650302Z",
"url": "https://files.pythonhosted.org/packages/71/88/2977c134b070f7a90b571a6cf6c15dae512dbf24368170129ddd307d69ff/json_sett-0.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aa0f53df73dea140a2b68bdde6d93670352f938a498595ec5b40397e5d52f326",
"md5": "bb6e242860243cc047ad96b5a1b7a9a2",
"sha256": "abe19f863d3e9bdbeba7e085b7e4a0627668cbaedd4f72ce91bef519fb093d84"
},
"downloads": -1,
"filename": "json-sett-0.0.0.tar.gz",
"has_sig": false,
"md5_digest": "bb6e242860243cc047ad96b5a1b7a9a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4251,
"upload_time": "2023-10-08T20:55:15",
"upload_time_iso_8601": "2023-10-08T20:55:15.526865Z",
"url": "https://files.pythonhosted.org/packages/aa/0f/53df73dea140a2b68bdde6d93670352f938a498595ec5b40397e5d52f326/json-sett-0.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-08 20:55:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Schnilsibus",
"github_project": "json_sett",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "json-sett"
}