{ "info": { "author": "Ben Windsor", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development", "Typing :: Typed" ], "description": "[![Build Status](https://travis-ci.org/bwindsor/typed-config-aws-sources.svg?branch=master)](https://travis-ci.org/bwindsor/typed-config-aws-sources)\n[![codecov](https://codecov.io/gh/bwindsor/typed-config-aws-sources/branch/master/graph/badge.svg)](https://codecov.io/gh/bwindsor/typed-config-aws-sources)\n\n# typed-config-aws-sources\nAWS config sources for the [typed-config](https://pypi.org/project/typed-config) package.\n\n`pip install typed-config-aws-sources`\n\nRequires python 3.6 or above.\n\n## Basic usage\nPlease read the readme for [typed-config](https://pypi.org/project/typed-config) first.\n\n```python\n# my_app/config.py\nfrom typedconfig_awssource import IniS3ConfigSource\nfrom typedconfig import Config, key, section\n\n@section('database')\nclass AppConfig(Config):\n port = key(cast=int)\n\nconfig = AppConfig()\nconfig.add_source(IniS3ConfigSource('my_bucket_name', 'config_key.cfg'))\nconfig.read()\n```\n\n```python\n# my_app/main.py\nfrom my_app.config import config\nprint(config.host)\n```\n\n### Supplied Config Sources\n#### `IniS3ConfigSource`\nThis loads configuration from an INI file stored in an S3 bucket\n```python\nfrom typedconfig_awssource import IniS3ConfigSource\nsource = IniS3ConfigSource('bucket_name', 'key_name.cfg', encoding='utf8', must_exist=True)\n```\n\n* Supply the bucket name and key name as the first two arguments\n* `encoding` defaults to `'utf8'` if not supplied\n* `must_exist` defaults to `True` if not supplied. If `must_exist` is `False`, and the bucket or key can't be found, or AWS credentials fail, then no error is thrown and this config source will just return than it cannot find the requested config value every time.\n\nAn example INI file might look like this:\n```ini\n[database]\nport = 2000\n```\n\n#### `DynamoDBConfigSource`\nThis reads configuration from a DynamoDB table. The table should have a partition key which holds the config section, a sort key which holds the config key name, and another 'column' containing the config value as a string.\n\nSo an item in DynamoDB corresponding to the above INI file example would look like this\n```json\n{\n \"section\": \"database\",\n \"key\": \"port\",\n \"value\": \"2000\"\n}\n```\n\nCreate the `DynamoDBConfigSource` like this:\n```python\nfrom typedconfig_awssource import DynamoDbConfigSource\nsource = DynamoDbConfigSource('table_name', \n section_attribute_name='config_section_column_name',\n key_attribute_name='config_key_column_name',\n value_attribute_name='config_value_column_name')\n```\n\n* The first argument is the DynamoDB table name and is required\n* The other three arguments are optional, and are supplying the attribute (or \"column\") names in the table which store the three things defining a config parameter (section, key, and value)\n* Default attribute names are `\"section\"`, `\"key\"`, and `\"value\"`\n\n#### `SecretsManagerConfigSource`\nThis reads secret values from secrets manager. Permission to read AWS secrets is required. One secrets should be stored for each config section with the name format `prefix/section`, and contain json key-value pairs. For example, for a project called `myproject` there may be a secret called `myproject/database` containing the following value. Note that even numeric values should be stored as strings.\n```json\n{\n \"user\": \"secretuser\",\n \"password\": \"secretpassword\"\n}\n```\n\nCreate the `SecretsManagerConfigSource` like this:\n```python\nfrom typedconfig_awssource import SecretsManagerConfigSource\nsource = SecretsManagerConfigSource('myproject', must_exist=False)\n```\n\n* The argument passed in the prefix which is placed before the `/` in the secret name. So when I try to get the database password, the secret `myproject/database` is retrieved, the JSON is parsed and value the field `password` is returned. \n* The `must_exist` argument specifies whether to error if AWS secretsmanager cannot be accessed. Default is `False`.\n\n## Contributing\nIdeas for new features and pull requests are welcome. PRs must come with tests included. This was developed using Python 3.7 but Travis tests run with v3.6 too.\n\n### Development setup\n1. Clone the git repository\n2. Create a virtual environment `virtualenv venv`\n3. Activate the environment `venv/scripts/activate`\n4. Install development dependencies `pip install -r requirements.txt`\n\n### Running tests\n`pytest`\n\nTo run with coverage:\n\n`pytest --cov`\n\n### Deploying to PyPI\nYou'll need to `pip install twine` if you don't have it.\n\n1. Bump version number in `typedconfig_awssource/__version__.py`\n2. Tag the release in git `git tag -a v0.1.0 -m \"Message\"`\n3. `python setup.py sdist bdist_wheel`\n4. `twine check dist/*`\n5. Upload to the test PyPI `twine upload --repository-url https://test.pypi.org/legacy/ dist/*`\n6. Check all looks ok at [https://test.pypi.org/project/typed-config-aws-sources](https://test.pypi.org/project/typed-config-aws-sources)\n7. Upload to live PyPI `twine upload dist/*`\n\nHere is [a good tutorial](https://realpython.com/pypi-publish-python-package) on publishing packages to PyPI.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bwindsor/typed-config-aws-sources", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "typed-config-aws-sources", "package_url": "https://pypi.org/project/typed-config-aws-sources/", "platform": "", "project_url": "https://pypi.org/project/typed-config-aws-sources/", "project_urls": { "Homepage": "https://github.com/bwindsor/typed-config-aws-sources" }, "release_url": "https://pypi.org/project/typed-config-aws-sources/0.2.2/", "requires_dist": [ "boto3", "typed-config" ], "requires_python": ">=3.6.0", "summary": "AWS config sources for the typedconfig package", "version": "0.2.2" }, "last_serial": 5440204, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "556497e29a5cbf5dea01d9299cafb858", "sha256": "98c4757036d6d4a16f2df1578e63697f2bd925773e3d1a021dab6754b2259ce8" }, "downloads": -1, "filename": "typed_config_aws_sources-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "556497e29a5cbf5dea01d9299cafb858", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5238, "upload_time": "2019-03-20T19:05:28", "url": "https://files.pythonhosted.org/packages/56/5c/36b2b5a238c39421a54263516e0d97eee56884d87db5b7233360fa7e16b7/typed_config_aws_sources-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa2b9fdcd295c149966b60e6875aa0ca", "sha256": "6420218b5d8cfbe772f72775e4bb67bf51313a03fbd918747477b55c7c82c790" }, "downloads": -1, "filename": "typed-config-aws-sources-0.1.0.tar.gz", "has_sig": false, "md5_digest": "aa2b9fdcd295c149966b60e6875aa0ca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4685, "upload_time": "2019-03-20T19:05:30", "url": "https://files.pythonhosted.org/packages/36/c2/1eec28032318dbbe446400413b99f24810a5a811cd60a50207774cd42abd/typed-config-aws-sources-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "751cf0e632134359cbedec4243b18c10", "sha256": "aaebaf149a0e14a830878f1056296feaee737ecbc2cd983cea71eaa75a886886" }, "downloads": -1, "filename": "typed_config_aws_sources-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "751cf0e632134359cbedec4243b18c10", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5235, "upload_time": "2019-03-20T19:09:14", "url": "https://files.pythonhosted.org/packages/9f/b6/7934fcc2fe4e856c7fc96a036ffbb3086ab697cf05f812898aafa9bae583/typed_config_aws_sources-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39b79a158dc25224d0d183d8b77f876a", "sha256": "9764a8387552d0b2f31617bf4c541dded5b6849559e2db8b7505d944be2de2d3" }, "downloads": -1, "filename": "typed-config-aws-sources-0.1.1.tar.gz", "has_sig": false, "md5_digest": "39b79a158dc25224d0d183d8b77f876a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4674, "upload_time": "2019-03-20T19:09:15", "url": "https://files.pythonhosted.org/packages/bd/cc/16e88802689a5a6e1e535f34271e1b5d8a3f6d83d107b54429cd98774d57/typed-config-aws-sources-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c0273fd9ce8831e1d9c2c69d9a1cf6ee", "sha256": "246f3f0fb7b9245d6d56e138afb206fbc7dea849875721ecf17401760394df11" }, "downloads": -1, "filename": "typed_config_aws_sources-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c0273fd9ce8831e1d9c2c69d9a1cf6ee", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5794, "upload_time": "2019-06-24T09:32:34", "url": "https://files.pythonhosted.org/packages/77/d4/a2685e8c003f8f424c80529484337d996e4189990501efe5c6dadf5f7439/typed_config_aws_sources-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "27ce0702301c2af89d3596f8d3c70628", "sha256": "9f9f916bb8dc5b89d29c9a8f0e580826b9c9449966a9f4be1b4793830775ed76" }, "downloads": -1, "filename": "typed-config-aws-sources-0.2.0.tar.gz", "has_sig": false, "md5_digest": "27ce0702301c2af89d3596f8d3c70628", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5301, "upload_time": "2019-06-24T09:32:36", "url": "https://files.pythonhosted.org/packages/07/e8/0598ffafe8bbffb917c17e3d4af591130d000721d51301968df5e61f7ee3/typed-config-aws-sources-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "bf4d338407bccfdaa599216c06832d87", "sha256": "f668a9f5c7a8daabd20898c92e39c00974eb1e5965891389c70ea6ae967e8ded" }, "downloads": -1, "filename": "typed_config_aws_sources-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bf4d338407bccfdaa599216c06832d87", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5874, "upload_time": "2019-06-24T10:08:04", "url": "https://files.pythonhosted.org/packages/4f/81/4e40599493b03e5a0c13493abb65b0ec4cd54298b487386116ad9da4ae5f/typed_config_aws_sources-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a6ff56db85454d51a63d2dd3a03504a", "sha256": "dd53ca9622fa30c32bef1412a0ba9f645df22fc8976c617d1ae9a3be655d65cc" }, "downloads": -1, "filename": "typed-config-aws-sources-0.2.1.tar.gz", "has_sig": false, "md5_digest": "5a6ff56db85454d51a63d2dd3a03504a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5436, "upload_time": "2019-06-24T10:08:05", "url": "https://files.pythonhosted.org/packages/60/f3/c2fcbe679f66480244ad6409e3cf2bf6cbce37bf64515863b9faa87845e9/typed-config-aws-sources-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "b8d6e82ec4bc233f45c8695e616cfe6c", "sha256": "330788b02007479138e272578f3ca72cfe1fa921d9a8c61c8646735f539b47ea" }, "downloads": -1, "filename": "typed_config_aws_sources-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b8d6e82ec4bc233f45c8695e616cfe6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5941, "upload_time": "2019-06-24T11:13:25", "url": "https://files.pythonhosted.org/packages/d7/7d/86bd3b34b6bbe6cc6d307f5175cc3e7271d4636280bf194e18eb709cb909/typed_config_aws_sources-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f352516fe736e7de3a3659b170fc5074", "sha256": "2a173ebf0d6a04159428fbbe132e77e0ad1afbcffabdc678ca758bc8c2783988" }, "downloads": -1, "filename": "typed-config-aws-sources-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f352516fe736e7de3a3659b170fc5074", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5496, "upload_time": "2019-06-24T11:13:26", "url": "https://files.pythonhosted.org/packages/80/7d/92e23e881c2649f676e0d9bb6e6c538f9b2e790824a82a6f6fc114a83031/typed-config-aws-sources-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b8d6e82ec4bc233f45c8695e616cfe6c", "sha256": "330788b02007479138e272578f3ca72cfe1fa921d9a8c61c8646735f539b47ea" }, "downloads": -1, "filename": "typed_config_aws_sources-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b8d6e82ec4bc233f45c8695e616cfe6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 5941, "upload_time": "2019-06-24T11:13:25", "url": "https://files.pythonhosted.org/packages/d7/7d/86bd3b34b6bbe6cc6d307f5175cc3e7271d4636280bf194e18eb709cb909/typed_config_aws_sources-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f352516fe736e7de3a3659b170fc5074", "sha256": "2a173ebf0d6a04159428fbbe132e77e0ad1afbcffabdc678ca758bc8c2783988" }, "downloads": -1, "filename": "typed-config-aws-sources-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f352516fe736e7de3a3659b170fc5074", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5496, "upload_time": "2019-06-24T11:13:26", "url": "https://files.pythonhosted.org/packages/80/7d/92e23e881c2649f676e0d9bb6e6c538f9b2e790824a82a6f6fc114a83031/typed-config-aws-sources-0.2.2.tar.gz" } ] }