{ "info": { "author": "Erick Daniszewski", "author_email": "edaniszewski@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "

\n \n \n \n \n\n

bison

\n

\n\n

Python application configuration

\n\n\n## What is Bison?\nBison is a configuration solution for Python applications that aims to be simple\nand intuitive. It supports:\n* reading from YAML config files\n* reading from environment variables\n* setting explicit values\n* setting defaults\n* configuration validation\n* configuration access/manipulation with dot notation\n\nInstead of implementing custom configuration reading and parsing, you can use\nBison to handle it for you.\n\nBison was inspired by [Viper][viper] and the lack of good\napplication configuration solutions for Python (at least, in my opinion). Documentation\nfor Bison can be found on [ReadtheDocs][docs]\n\nBison uses the following precedence order. Each item in the list takes precedence\nover the item below it.\n- override (e.g. calling `Bison.set()`)\n- environment\n- config file\n- defaults\n\n## Installation\nBison can be installed with `pip`\n```\npip install bison\n```\nor with `pipenv`\n```\npipenv install bison\n```\n\n## Using Bison\n### Creating a configuration Scheme\nA configuration scheme is not required by Bison, but having one allows you to set default\nvalues for configuration fields as well as do configuration validation. It is pretty easy\nto create a new Scheme:\n\n```python\nscheme = bison.Scheme()\n```\n\nA Scheme is really just a container for configuration options, so without any options, a\nScheme is somewhat useless.\n\n#### Configuration Options\nThere are currently three types of configuration options:\n- `bison.Option`\n- `bison.DictOption`\n- `bison.ListOption`\n\nTheir intended functionality should be mostly obvious from their names. An `Option` represents\na singular value in a configuration. A `DictOption` represents a dictionary or mapping of values\nin a configuration. A `ListOption` represents a list of values in a configuration.\n\nSee the [documentation][docs] for more on how options can be configured.\n\nAny number of options can be added to a Scheme, but as a simple example we can define a Scheme\nwhich expects a key \"log\", and a key \"count\".\n\n```python\nscheme = bison.Scheme(\n bison.Option('log'),\n bison.Option('count'),\n)\n```\n\n#### Configuration Validation\nValidation operates based on the constraints set on the options. Above, there are no\nconstraints (other than the need for those keys to exist), so any value for \"log\" and\n\"count\" will pass validation.\n\nAn option can be constrained in different ways by using its keyword arguments. For example,\nto ensure the value for \"count\" is an integer,\n```python\nbison.Option('count', field_type=int)\n```\n\nOr, to restrict the values to a set of choices\n```python\nbison.Option('log', choices=['debug', 'info', 'warn', 'error'])\n```\n\nThe [documentation][docs] goes into more detail about other validation settings.\n\n#### Setting Defaults\nIf a default value is not set on an option, it is considered required. In these cases,\nif the key specified by that value is not present in the parse configuration, it will\ncause a validation failure.\n\nIf a default value is set, then the absence of that field in the configuration will not\ncause a validation failure.\n\n```python\nbison.Option('log', default='info')\n```\n\n### Configuring Bison\nOnce you have a Scheme to use (if you'd like to), it will need to be passed to a Bison\nobject to manage the config building. \n\n```python\nscheme = bison.Scheme()\nconfig = bison.Bison(scheme)\n```\n\nThere are a few options that can be set on the Bison object to change how it\nsearches for and builds the unified configuration. \n\nFor reading configuration files\n```python\nconfig.config_name = 'config' # name of the config file (no extension)\nconfig.add_config_paths( # paths to look in for the config file\n '.',\n '/tmp/app'\n)\nconfig.config_format = bison.YAML # the config format to use\n```\n\nFor reading environment variables\n```python\nconfig.env_prefix = \"MY_APP\" # the prefix to use for environment variables\nconfig.auto_env = True # automatically bind all options to env variables based on their key\n```\n\n### Building the unified config\nOnce the scheme has been set (if using) and Bison has been configured, the only thing\nleft to do is to read in all the config sources and parse them into a unified config.\nThis is done simply with\n```python\nconfig.parse()\n```\n\n### Example\nBelow is a complete example for parsing a hypothetical application configuration which\nis described by the following YAML config.\n```yaml\nlog: debug\nport: 5000\nsettings:\n requests:\n timeout: 3\nbackends:\n - host: 10.1.2.3\n port: 5001\n - host: 10.1.2.4\n port: 5013\n - host: 10.1.2.5\n port: 5044\n```\n\n```python\nimport bison\n\n# the scheme for the configuration. this allows us to set defaults\n# and validate configuration data\nconfig_scheme = bison.Scheme(\n bison.Option('log', default='info', choices=['debug', 'info', 'warn', 'error']),\n bison.Option('port', field_type=int),\n bison.DictOption('settings', scheme=bison.Scheme(\n bison.DictOption('requests', scheme=bison.Scheme(\n bison.Option('timeout', field_type=int)\n ))\n )),\n bison.ListOption('backends', member_scheme=bison.Scheme(\n bison.Option('host', field_type=str),\n bison.Option('port', field_type=int)\n ))\n)\n\n# create a new Bison instance to store and manage configuration data\nconfig = bison.Bison(scheme=config_scheme)\n\n# set the config file name to 'app' (default is 'config') and set the\n# search paths to '.' and '/tmp/app/config'\nconfig.config_name = 'app'\nconfig.add_config_paths('.', '/tmp/app/config')\n\n# set the environment variable prefix and enable auto-env\nconfig.env_prefix = 'MY_APP'\nconfig.auto_env = True\n\n# finally, parse the config sources to build the unified configuration\nconfig.parse()\n```\n\nSee the [example](example) directory for this example along with demonstrations\nof how to access configuration data.\n\n## Future Work\nThere is more that can be done to improve Bison and expand its functionality. If\nyou wish to contribute, open a pull request. If you have questions or feature requests,\nopen an issue. Below are some high level ideas for future improvements:\n\n* Support additional configuration formats (JSON, TOML, ...)\n* Versioned configurations\n\n\n[docs]: http://readthedocs\n[viper]: https://github.com/spf13/viper\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/edaniszewski/bison", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "bison", "package_url": "https://pypi.org/project/bison/", "platform": "", "project_url": "https://pypi.org/project/bison/", "project_urls": { "Homepage": "https://github.com/edaniszewski/bison" }, "release_url": "https://pypi.org/project/bison/0.1.2/", "requires_dist": [ "pyyaml (>=4.2b1)" ], "requires_python": ">=3.4", "summary": "Python application configuration", "version": "0.1.2" }, "last_serial": 5913802, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "7c77e696bd15019fae2a6438f77919f6", "sha256": "59bccffa9ece93f4d4d0cb2ab510beaab74ae7c2b786c6fcea474cc94807a74b" }, "downloads": -1, "filename": "bison-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7c77e696bd15019fae2a6438f77919f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 23911, "upload_time": "2018-03-08T05:57:54", "url": "https://files.pythonhosted.org/packages/d0/59/1665577e705feaa2f0135e0de779cbb0f75b546ca8ddbfbc4960431dc0a0/bison-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce4bc1e3c06889101566dcf3620d27a0", "sha256": "23cc83070c8d003c2e70b91365da7cc8c5ecaa9c97eeb01f7edfc349952ae717" }, "downloads": -1, "filename": "bison-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ce4bc1e3c06889101566dcf3620d27a0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 17123, "upload_time": "2018-03-08T05:57:56", "url": "https://files.pythonhosted.org/packages/4c/2b/be4601218f6c5e968da2580c0ece23fead89781ccaec938017e11699e19b/bison-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "bb15f5a9932b990d6dc4e142bd82b7a6", "sha256": "8633e4ac289512d61f2d73a986c4f5a94a2535e1f53213348da0222b58c91b8e" }, "downloads": -1, "filename": "bison-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bb15f5a9932b990d6dc4e142bd82b7a6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 25166, "upload_time": "2018-03-08T17:40:25", "url": "https://files.pythonhosted.org/packages/3f/c2/c46b550c022c09e7d15b4d37a2df0c0447b57cf8fcddc65e9819e4bfe14e/bison-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "522ed7ff0a90bac9522ae53f5f757d9d", "sha256": "3356096b71327fb8038eafa89d031788062a40a0e922d6d83f8b280031ddbdc1" }, "downloads": -1, "filename": "bison-0.0.2.tar.gz", "has_sig": false, "md5_digest": "522ed7ff0a90bac9522ae53f5f757d9d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 18252, "upload_time": "2018-03-08T17:40:27", "url": "https://files.pythonhosted.org/packages/f7/9a/4b37eb7296a40467cc07ce75883c2e492fc510f38d9ac8345003dee04216/bison-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "3bc0b374cda44cb0bdde57c434800975", "sha256": "c08efc64a57407c1d1531f2821f87487a062c9202d23ecf6a4fa92fc58e8b848" }, "downloads": -1, "filename": "bison-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3bc0b374cda44cb0bdde57c434800975", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 25545, "upload_time": "2018-03-08T22:02:50", "url": "https://files.pythonhosted.org/packages/ff/57/87ca4488fb5f3babeb90db6404b1f0c372c08c720bf0d6b401af964fd90f/bison-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b2ef54428443494129de736a5540d4c", "sha256": "56082387e8d7a50c9d935df0c05aa227d0522d6f41b9095b5811c3a73cab2846" }, "downloads": -1, "filename": "bison-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9b2ef54428443494129de736a5540d4c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 18575, "upload_time": "2018-03-08T22:02:52", "url": "https://files.pythonhosted.org/packages/7d/95/dbe84d3e9740ae547d93546fabc682063d36956840c762fe8ec8ae605074/bison-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "00a310984bcf1dec530355998f9e40a9", "sha256": "0133620cbf406fc2f3ad7760789790aeb419e92a2d4e911ffd38c17bc3faa9a5" }, "downloads": -1, "filename": "bison-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "00a310984bcf1dec530355998f9e40a9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 25690, "upload_time": "2018-03-09T15:05:01", "url": "https://files.pythonhosted.org/packages/76/dc/e2dca597ca2023c8c1a8fc489b5380e5966e90a74b8a1337cb8ce7c08fa3/bison-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "583cae63f8c79c76425e02d62801c5a6", "sha256": "d388968a09c2d623441237f41db8988b7bc3447ce8f3ff15c1ac248ffc629f8d" }, "downloads": -1, "filename": "bison-0.0.4.tar.gz", "has_sig": false, "md5_digest": "583cae63f8c79c76425e02d62801c5a6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 18711, "upload_time": "2018-03-09T15:05:02", "url": "https://files.pythonhosted.org/packages/80/28/8b964f2a11569b75f2c108eb50d3bf142c67eeb4e2d2e0b0d697331f24c3/bison-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "51f5b3fb4535b4d46b8a0e0b661e41bf", "sha256": "38a2b8ce685601239d80d3e46366654eb1c761c9d0f5003b60ec52654a82201e" }, "downloads": -1, "filename": "bison-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "51f5b3fb4535b4d46b8a0e0b661e41bf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 26852, "upload_time": "2018-03-16T13:15:15", "url": "https://files.pythonhosted.org/packages/d4/22/eb1c27e9dddfd66653773424fa1b65c50076492efde8eab4fe3d6a27eb9e/bison-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b9a334097e2d1e3da208013dcfa0e7d", "sha256": "21990e3bdfb4d9ec779b9362a4a7b7ada24d93e70f5c0bdfb9c5ec092fda8a5f" }, "downloads": -1, "filename": "bison-0.0.5.tar.gz", "has_sig": false, "md5_digest": "4b9a334097e2d1e3da208013dcfa0e7d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 19822, "upload_time": "2018-03-16T13:15:17", "url": "https://files.pythonhosted.org/packages/cf/55/e2677c8f8c73ced5241414596f39acf606a526b71c88e5c4a754f4ec28f8/bison-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "9621dd13cbcebc5c8a455db220cda549", "sha256": "248e91451117b5519721c52fb27f5f9be3a4ada82bfcf3329ee026d2ae9615cf" }, "downloads": -1, "filename": "bison-0.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9621dd13cbcebc5c8a455db220cda549", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 27474, "upload_time": "2018-09-01T20:05:25", "url": "https://files.pythonhosted.org/packages/23/76/f20ec2b5c4dfb9a8fc8ef80e4df25e7bdc808861a0f95222c3540150d497/bison-0.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "859e989141b5ee6edde0996acfc85782", "sha256": "be0c1eaa92f02969534088b59d0645a071e66d7c34fcfc956e9e50e91ad6cf0e" }, "downloads": -1, "filename": "bison-0.0.6.tar.gz", "has_sig": false, "md5_digest": "859e989141b5ee6edde0996acfc85782", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 23303, "upload_time": "2018-09-01T20:05:26", "url": "https://files.pythonhosted.org/packages/90/55/ecc94c0fd082117e4fa5b35e39d1efa7579a087d589493d27fb2ca17a6a9/bison-0.0.6.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "5c5e20a58251879114d6a5e2b0ffa12c", "sha256": "79fa44a2b3ea68b9b9dd62baec646191324cb227c41980eb96a0c52d47188ccc" }, "downloads": -1, "filename": "bison-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5c5e20a58251879114d6a5e2b0ffa12c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 27574, "upload_time": "2018-10-26T14:27:09", "url": "https://files.pythonhosted.org/packages/28/ff/c55f567dc3c852a8d051ff77e3eacb550afe1089389920b8bcf816f28bfb/bison-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9bec8d85942dcb9a28f493052d875a7c", "sha256": "5e7b54f9164daf3409c7b047ae6fe8cb47a39a47a70cab93054c7e2bffc25ff3" }, "downloads": -1, "filename": "bison-0.1.0.tar.gz", "has_sig": false, "md5_digest": "9bec8d85942dcb9a28f493052d875a7c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 23448, "upload_time": "2018-10-26T14:27:10", "url": "https://files.pythonhosted.org/packages/28/04/1e83ca95c5f50f90f050a368d9a7ac578e7331c7a2e975c89f7c1b255985/bison-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9ca8d05de45ad6c6f503419fa88c7be2", "sha256": "b1786da1714ceec08baf95fea0c5cfa2292d04c0c51674d2347a8652de10ef61" }, "downloads": -1, "filename": "bison-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9ca8d05de45ad6c6f503419fa88c7be2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 24382, "upload_time": "2019-08-15T18:49:07", "url": "https://files.pythonhosted.org/packages/5a/2e/89ab234959dd45ef5f868cca61933c9e0ffc84f4a1fe083a48e97d0105b0/bison-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b8694a178a997a09923a4ec6d7e8fe9", "sha256": "13105bb75fa30b35f7ade15a76c5654f0769bc0b4162ff014764ac42c50d1715" }, "downloads": -1, "filename": "bison-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9b8694a178a997a09923a4ec6d7e8fe9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 24413, "upload_time": "2019-08-15T18:49:08", "url": "https://files.pythonhosted.org/packages/4a/f1/bbba71c9e6ea6ebf97cf44e4cb7e2f409c34d00aa477a345c9c49fa9e892/bison-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "001f39a56d178ba06ed1346e01eebec5", "sha256": "394aa780aa7bc0e6ea5d719aa97e1be8f1633b1a8a7f6c1cd0ae15a45e4336da" }, "downloads": -1, "filename": "bison-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "001f39a56d178ba06ed1346e01eebec5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 24502, "upload_time": "2019-10-01T17:12:39", "url": "https://files.pythonhosted.org/packages/e7/60/8aa4308a82fd5fecb0728bfbbe4006a7e7498210c3e3fc4a048f8bdd6c9c/bison-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9364917f1b9fe4045f3213a82acca2b0", "sha256": "9b93a38a4acb1d3b04b1472c4cbdfd0e6317db9f77a3393cfbaf1b641ef90666" }, "downloads": -1, "filename": "bison-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9364917f1b9fe4045f3213a82acca2b0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 24548, "upload_time": "2019-10-01T17:12:40", "url": "https://files.pythonhosted.org/packages/2d/e0/6eb6a24e4400536db9958310b81e6448b7055766e59ec2273db4a4d6b322/bison-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "001f39a56d178ba06ed1346e01eebec5", "sha256": "394aa780aa7bc0e6ea5d719aa97e1be8f1633b1a8a7f6c1cd0ae15a45e4336da" }, "downloads": -1, "filename": "bison-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "001f39a56d178ba06ed1346e01eebec5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 24502, "upload_time": "2019-10-01T17:12:39", "url": "https://files.pythonhosted.org/packages/e7/60/8aa4308a82fd5fecb0728bfbbe4006a7e7498210c3e3fc4a048f8bdd6c9c/bison-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9364917f1b9fe4045f3213a82acca2b0", "sha256": "9b93a38a4acb1d3b04b1472c4cbdfd0e6317db9f77a3393cfbaf1b641ef90666" }, "downloads": -1, "filename": "bison-0.1.2.tar.gz", "has_sig": false, "md5_digest": "9364917f1b9fe4045f3213a82acca2b0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 24548, "upload_time": "2019-10-01T17:12:40", "url": "https://files.pythonhosted.org/packages/2d/e0/6eb6a24e4400536db9958310b81e6448b7055766e59ec2273db4a4d6b322/bison-0.1.2.tar.gz" } ] }