Badger-Config-Handler-publishing-test


NameBadger-Config-Handler-publishing-test JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryConfig handler for code-declared and file-defined settings.
upload_time2023-09-28 22:54:43
maintainer
docs_urlNone
authorpidi3000
requires_python>=3.10
license
keywords settings handler config handler json yaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Badger_Config_Handler
A python library for handling code-declared and file-defined settings.

Supports saving to JSON and YAML files.


# Data types

## native
the file handlers have native support for these types and are used as is,
no conversion is done on these values
- string
- int
- float
- bool
- None / null

---
## supported
### Badger_Config_Section
converted using 
- serialize: `{VAR}.to_dict()` 
- de-serialize: `Badger_Config_Section.from_dict({VAR})`

### datetime.datetime
converted using 
- serialize: `{VAR}.isoformat()` 
- de-serialize: `datetime.fromisoformat({VAR})`

### pathlib.Path
converted using 
- serialize: `str({VAR})` 
- de-serialize: `pathlib.Path({VAR})`

---
## Collections

NOTE:

It is recommended to use a [Config Section](#config-section) instead of Collections.

If collections are used items should be of [native](#native) type only,
if they are not of [native](#native) type they are serialized but can NOT be de-serialize.

Code using these values must handle these cases.

### dict

### list


---
---
---
# Config Base

---
## Property's

---

### _config_file_path
> path to the config file

---


### ALLOWED_FILE_TYPES
> all allowed file extensions

---
---
## Function's

---

### setup()
see [Config_Section.setup()](#setup-1)

---

### save()
Save config to file

---

### load()
Load config from file

---

### sync()
Sync config with file

runs: `load()` - `save()` - `load()`

this adds new config fields to the file or removes old ones


---
---
---

# Config Section
---
## Property's

---

### section_name
> name of the current section

---

### root_path
> by default the project root path or overridden by the parent section

---

### parent_section
> reference to the parent section (if it exists)

---
---
## Function's

---

### setup()
Replacement for `__init__()`

should be used to set default values

NOTE: the property [parent_section](#parent_section) is NOT available during this

---

### pre_process()
Pre process values before [save()](#save)

useful for:
- converting unsupported data type to a [native](#native) or [supported](#supported) type
- converting absolute paths to relative (keeps them short in the config file)

---

### post_process()
post process values after [load()](#load)

useful for:
- creating unsupported data type from [native](#native) or [supported](#supported) type
- converting relative paths to absolute (keeps them short in the config file)

---

### to_dict(bool)
converts all values to a dictionary 

**Parameters:**

| param             | type | required | default |
|-------------------|------|----------|---------|
| convert_to_native | bool |          | True    |

---

### from_dict()
Reconstruct Config Section from dictionary

**Parameters:**

 | param          | type                           | description                                                                                                                        | required | default |
|----------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------|----------|---------|
| data           | dict\[str, [native](#native)\] | the dict representation of this section (as generated from [to_dict(True)](#to_dictbool) )                                         | x        |         |
| safe_load      | bool                           | ! UNTESTED ! <br> True -> Only variables that already exist in the class are set (uses `hasattr`) <br> False -> New variables can be set from config file |          | True    |
| danger_convert | bool                           | ! UNTESTED ! <br> For details see docs of `_native_to_var()`                                                                        |          | False   |


---

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "Badger-Config-Handler-publishing-test",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "settings handler,config handler,json,yaml",
    "author": "pidi3000",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/39/1d/c97cdcdf0594e5138f625bf9852f7874357120d66591b9310528f08cdb91/Badger-Config-Handler-publishing-test-0.2.1.tar.gz",
    "platform": null,
    "description": "# Badger_Config_Handler\nA python library for handling code-declared and file-defined settings.\n\nSupports saving to JSON and YAML files.\n\n\n# Data types\n\n## native\nthe file handlers have native support for these types and are used as is,\nno conversion is done on these values\n- string\n- int\n- float\n- bool\n- None / null\n\n---\n## supported\n### Badger_Config_Section\nconverted using \n- serialize: `{VAR}.to_dict()` \n- de-serialize: `Badger_Config_Section.from_dict({VAR})`\n\n### datetime.datetime\nconverted using \n- serialize: `{VAR}.isoformat()` \n- de-serialize: `datetime.fromisoformat({VAR})`\n\n### pathlib.Path\nconverted using \n- serialize: `str({VAR})` \n- de-serialize: `pathlib.Path({VAR})`\n\n---\n## Collections\n\nNOTE:\n\nIt is recommended to use a [Config Section](#config-section) instead of Collections.\n\nIf collections are used items should be of [native](#native) type only,\nif they are not of [native](#native) type they are serialized but can NOT be de-serialize.\n\nCode using these values must handle these cases.\n\n### dict\n\n### list\n\n\n---\n---\n---\n# Config Base\n\n---\n## Property's\n\n---\n\n### _config_file_path\n> path to the config file\n\n---\n\n\n### ALLOWED_FILE_TYPES\n> all allowed file extensions\n\n---\n---\n## Function's\n\n---\n\n### setup()\nsee [Config_Section.setup()](#setup-1)\n\n---\n\n### save()\nSave config to file\n\n---\n\n### load()\nLoad config from file\n\n---\n\n### sync()\nSync config with file\n\nruns: `load()` - `save()` - `load()`\n\nthis adds new config fields to the file or removes old ones\n\n\n---\n---\n---\n\n# Config Section\n---\n## Property's\n\n---\n\n### section_name\n> name of the current section\n\n---\n\n### root_path\n> by default the project root path or overridden by the parent section\n\n---\n\n### parent_section\n> reference to the parent section (if it exists)\n\n---\n---\n## Function's\n\n---\n\n### setup()\nReplacement for `__init__()`\n\nshould be used to set default values\n\nNOTE: the property [parent_section](#parent_section) is NOT available during this\n\n---\n\n### pre_process()\nPre process values before [save()](#save)\n\nuseful for:\n- converting unsupported data type to a [native](#native) or [supported](#supported) type\n- converting absolute paths to relative (keeps them short in the config file)\n\n---\n\n### post_process()\npost process values after [load()](#load)\n\nuseful for:\n- creating unsupported data type from [native](#native) or [supported](#supported) type\n- converting relative paths to absolute (keeps them short in the config file)\n\n---\n\n### to_dict(bool)\nconverts all values to a dictionary \n\n**Parameters:**\n\n| param             | type | required | default |\n|-------------------|------|----------|---------|\n| convert_to_native | bool |          | True    |\n\n---\n\n### from_dict()\nReconstruct Config Section from dictionary\n\n**Parameters:**\n\n | param          | type                           | description                                                                                                                        | required | default |\n|----------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------|----------|---------|\n| data           | dict\\[str, [native](#native)\\] | the dict representation of this section (as generated from [to_dict(True)](#to_dictbool) )                                         | x        |         |\n| safe_load      | bool                           | ! UNTESTED ! <br> True -> Only variables that already exist in the class are set (uses `hasattr`) <br> False -> New variables can be set from config file |          | True    |\n| danger_convert | bool                           | ! UNTESTED ! <br> For details see docs of `_native_to_var()`                                                                        |          | False   |\n\n\n---\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Config handler for code-declared and file-defined settings.",
    "version": "0.2.1",
    "project_urls": {
        "Repository": "https://github.com/pidi3000/Badger_Config_Handler"
    },
    "split_keywords": [
        "settings handler",
        "config handler",
        "json",
        "yaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63fc119a31575ec856ee38d68931ef87dee90096f634e7db632f4b75b8a6a0db",
                "md5": "ad3d28065032bcb991d58dea09856789",
                "sha256": "9bcde3ddbfb91c3d500e5f24183bf1fcffd86a12224078ea4009131900f68c59"
            },
            "downloads": -1,
            "filename": "Badger_Config_Handler_publishing_test-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ad3d28065032bcb991d58dea09856789",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12009,
            "upload_time": "2023-09-28T22:54:42",
            "upload_time_iso_8601": "2023-09-28T22:54:42.304691Z",
            "url": "https://files.pythonhosted.org/packages/63/fc/119a31575ec856ee38d68931ef87dee90096f634e7db632f4b75b8a6a0db/Badger_Config_Handler_publishing_test-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "391dc97cdcdf0594e5138f625bf9852f7874357120d66591b9310528f08cdb91",
                "md5": "c3fe177e19d430a7098f7ea4a3a6bbec",
                "sha256": "13ee432831571242086af9682e6277c24a12d52280d38fd55344bf79ad7dc5b4"
            },
            "downloads": -1,
            "filename": "Badger-Config-Handler-publishing-test-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c3fe177e19d430a7098f7ea4a3a6bbec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11888,
            "upload_time": "2023-09-28T22:54:43",
            "upload_time_iso_8601": "2023-09-28T22:54:43.902380Z",
            "url": "https://files.pythonhosted.org/packages/39/1d/c97cdcdf0594e5138f625bf9852f7874357120d66591b9310528f08cdb91/Badger-Config-Handler-publishing-test-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-28 22:54:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pidi3000",
    "github_project": "Badger_Config_Handler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "badger-config-handler-publishing-test"
}
        
Elapsed time: 0.13773s