# Krausening Python - Externalized Property Management and Access for Python Projects #
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit)
[![PyPI](https://img.shields.io/pypi/v/krausening?logo=python&logoColor=gold)](https://pypi.org/project/krausening/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/krausening?logo=python&logoColor=gold)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/krausening?logo=python&logoColor=gold)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/krausening?color=blue&label=Installs&logo=pypi&logoColor=gold)](https://pypi.org/project/krausening/)
Krausening property management and encryption for Python is packaged using the open-source Python Maven plugin [Habushu](https://bitbucket.org/cpointe/habushu) and made available as a [PyPI package](https://pypi.org/project/krausening/).
## Distribution Channel
Krausening Python is published to PyPI under the [krausening](https://pypi.org/project/krausening/) project and may be installed using any package installer/manager that leverages PyPI. For example:
* [Poetry](https://python-poetry.org/) - `poetry add krausening`
* [pip](https://pip.pypa.io/) - `pip install krausening`
## Managing Properties with Krausening and Python
Managing properties with Krausening's Python library utilizes a similar approach to that required by Krausening Java. Krausening Python expects that developers prime their target environment by configuring the following environment variables (which are named and leveraged in the same manner as the Java System Properties expected by Krausening Java):
* `KRAUSENING_BASE`
* `KRAUSENING_EXTENSIONS`
* `KRAUSENING_OVERRIDE_EXTENSIONS`
* `KRAUSENING_PASSWORD`
In order to use the Krausening Python, developers may directly use `PropertyManager` or extend `PropertyManager` to provide a custom interface. For example, developers may directly use the `PropertyManager` as such:
```python
from krausening.properties import PropertyManager
propertyManager = PropertyManager.get_instance()
properties = None
properties = propertyManager.get_properties('my-property-file.properties')
assert properties['foo'] == 'bar2'
```
This has the disadvantage that you must know the property keys in order to find the corresponding property values. To mitigate the need for all property file consumers to rely on specific property keys, consider wrapping the `PropertyManager` and writing your own custom methods to get the corresponding keys and values, abstracting away the exact key values:
```python
from krausening.properties import PropertyManager
class TestConfig():
"""
Configurations utility class for being able to read in and reload properties
"""
def __init__(self):
self.properties = None
self.reload()
def integration_test_enabled(self):
"""
Returns whether the integration tests are enabled or not
"""
integration_test_enable = False
integration_enable_str = self.properties['integration.test.enabled']
if (integration_enable_str):
integration_test_enable = (integration_enable_str == 'True')
return integration_test_enable
def reload(self):
self.properties = PropertyManager.get_instance().get_properties('test.properties')
```
## Releasing to PyPI
Releasing Krausening Python integrates into the project's larger utilization of the `maven-release-plugin`, specifically publishing the package to PyPI during the `deploy` phase. A [PyPI account](https://pypi.org/account/register/) with access to the [krausening](https://pypi.org/project/krausening/) project is required. PyPI account credentials should be specified in your `settings.xml` under the `<id>pypi</id>` `<server>` entry:
```xml
<settings>
<servers>
<server>
<id>pypi</id>
<username>pypi-username</username>
<password>pypi-password</password>
</server>
</servers>
</settings>
```
Raw data
{
"_id": null,
"home_page": "https://github.com/TechnologyBrewery/krausening",
"name": "krausening",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "properties, configuration-management",
"author": "Eric Konieczny",
"author_email": "ekoniec1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/21/fd/3e2318402f5e198524074edcc5022d2ebb00b9aa7da3ef3b97427f7b79ed/krausening-20.tar.gz",
"platform": null,
"description": "# Krausening Python - Externalized Property Management and Access for Python Projects #\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/mit)\n[![PyPI](https://img.shields.io/pypi/v/krausening?logo=python&logoColor=gold)](https://pypi.org/project/krausening/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/krausening?logo=python&logoColor=gold)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/krausening?logo=python&logoColor=gold)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/krausening?color=blue&label=Installs&logo=pypi&logoColor=gold)](https://pypi.org/project/krausening/)\n\nKrausening property management and encryption for Python is packaged using the open-source Python Maven plugin [Habushu](https://bitbucket.org/cpointe/habushu) and made available as a [PyPI package](https://pypi.org/project/krausening/). \n\n## Distribution Channel\n\nKrausening Python is published to PyPI under the [krausening](https://pypi.org/project/krausening/) project and may be installed using any package installer/manager that leverages PyPI. For example:\n\n* [Poetry](https://python-poetry.org/) - `poetry add krausening`\n* [pip](https://pip.pypa.io/) - `pip install krausening`\n\n## Managing Properties with Krausening and Python\n\nManaging properties with Krausening's Python library utilizes a similar approach to that required by Krausening Java. Krausening Python expects that developers prime their target environment by configuring the following environment variables (which are named and leveraged in the same manner as the Java System Properties expected by Krausening Java):\n\n* `KRAUSENING_BASE`\n* `KRAUSENING_EXTENSIONS`\n* `KRAUSENING_OVERRIDE_EXTENSIONS`\n* `KRAUSENING_PASSWORD`\n\nIn order to use the Krausening Python, developers may directly use `PropertyManager` or extend `PropertyManager` to provide a custom interface. For example, developers may directly use the `PropertyManager` as such:\n\n```python\nfrom krausening.properties import PropertyManager\n\npropertyManager = PropertyManager.get_instance()\nproperties = None\nproperties = propertyManager.get_properties('my-property-file.properties')\nassert properties['foo'] == 'bar2'\n```\n\nThis has the disadvantage that you must know the property keys in order to find the corresponding property values. To mitigate the need for all property file consumers to rely on specific property keys, consider wrapping the `PropertyManager` and writing your own custom methods to get the corresponding keys and values, abstracting away the exact key values:\n\n```python\nfrom krausening.properties import PropertyManager\n\nclass TestConfig():\n \"\"\"\n Configurations utility class for being able to read in and reload properties\n \"\"\"\n\n def __init__(self):\n self.properties = None\n self.reload()\n \n def integration_test_enabled(self):\n \"\"\"\n Returns whether the integration tests are enabled or not\n \"\"\"\n integration_test_enable = False\n integration_enable_str = self.properties['integration.test.enabled']\n if (integration_enable_str):\n integration_test_enable = (integration_enable_str == 'True')\n return integration_test_enable\n \n def reload(self):\n self.properties = PropertyManager.get_instance().get_properties('test.properties')\n```\n## Releasing to PyPI\n\nReleasing Krausening Python integrates into the project's larger utilization of the `maven-release-plugin`, specifically publishing the package to PyPI during the `deploy` phase. A [PyPI account](https://pypi.org/account/register/) with access to the [krausening](https://pypi.org/project/krausening/) project is required. PyPI account credentials should be specified in your `settings.xml` under the `<id>pypi</id>` `<server>` entry:\n\n```xml\n<settings>\n <servers>\n <server>\n <id>pypi</id>\n <username>pypi-username</username>\n <password>pypi-password</password>\n </server>\n </servers>\n</settings>\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python implementation of Krausening",
"version": "20",
"project_urls": {
"Homepage": "https://github.com/TechnologyBrewery/krausening",
"Repository": "https://github.com/TechnologyBrewery/krausening"
},
"split_keywords": [
"properties",
" configuration-management"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6c481d055739a1aae3598009b19f2a6ffa259c936883e376d940f21c548caf3",
"md5": "d799891695ce43478c7361fc21bb1b7f",
"sha256": "c3e62b1908e5589dbb39b2061a968f6b2a6817881e327ab7bd514b5d443e6f0e"
},
"downloads": -1,
"filename": "krausening-20-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d799891695ce43478c7361fc21bb1b7f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7296,
"upload_time": "2024-09-19T21:46:27",
"upload_time_iso_8601": "2024-09-19T21:46:27.554988Z",
"url": "https://files.pythonhosted.org/packages/d6/c4/81d055739a1aae3598009b19f2a6ffa259c936883e376d940f21c548caf3/krausening-20-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "21fd3e2318402f5e198524074edcc5022d2ebb00b9aa7da3ef3b97427f7b79ed",
"md5": "70bb44a19d050fb978a9d2edc404a223",
"sha256": "0616005734cdfb75b6e3beaf2c1dd8d96ac929c9ca9214949f5458a10835335f"
},
"downloads": -1,
"filename": "krausening-20.tar.gz",
"has_sig": false,
"md5_digest": "70bb44a19d050fb978a9d2edc404a223",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5671,
"upload_time": "2024-09-19T21:46:28",
"upload_time_iso_8601": "2024-09-19T21:46:28.803296Z",
"url": "https://files.pythonhosted.org/packages/21/fd/3e2318402f5e198524074edcc5022d2ebb00b9aa7da3ef3b97427f7b79ed/krausening-20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-19 21:46:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TechnologyBrewery",
"github_project": "krausening",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "krausening"
}