{ "info": { "author": "Paul Colomiets", "author_email": "paul@colomiets.name", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "===============\nTrafaret Config\n===============\n\n\n:Status: Stable\n:Documentation: http://trafaret-config.readthedocs.io/\n\n\nThis is a wrapper that loads yaml and checks config using trafaret_ while\nkeeping track of actual lines of file where error has happened. Additionally,\nit can pretty print the error.\n\nBasic Usage:\n\n.. code-block:: python\n\n import argparse\n import trafaret\n from trafaret_config import commandline\n\n TRAFARET = trafaret.Dict({'x': trafaret.String()})\n\n def main():\n ap = argparse.ArgumentParser()\n commandline.standard_argparse_options(ap, default_config='config.yaml')\n #\n # define your command-line arguments here\n #\n options = ap.parse_args()\n config = commandline.config_from_options(options, TRAFARET)\n pprint.pprint(config)\n\nExample output when there is an error in config (from a `example.py` which\nhas better trafaret than example above)::\n\n bad.yaml:3: smtp.port: value can't be converted to int\n -> 'unknown'\n bad.yaml:4: smtp.ssl_port: value can't be converted to int\n -> 'NaN'\n bad.yaml:5: port: value can't be converted to int\n -> '???'\n\nHelp looks like this::\n\n usage: example.py [-h] [-c CONFIG] [--print-config] [--print-config-vars] [-C]\n\n optional arguments:\n -h, --help show this help message and exit\n -c CONFIG, --config CONFIG\n Configuration file (default: 'config.yaml')\n --print-config Print config as it is read after parsing and exit\n --print-config-vars Print variables used in configuration file\n -C, --check-config Check configuration and exit\n\n\nSince trafaret-config 2.0 environment variables in the config are replaced\nby default, this means that config like this:\n\n.. code-block:: yaml\n\n url: http://${HOST}:$PORT/\n\nWill get ``HOST`` and ``PORT`` variables insert from the environment, and if\nvariable does not exist, you will get the following error::\n\n config.yaml:2: variable 'PORT' not found\n -> 'http://${HOST}:$PORT/'\n\nLow-level interface, without relying on argparse:\n\n.. code-block:: python\n\n import sys\n import trafaret\n from trafaret_config import ConfigError, read_and_validate\n\n TRAFARET = trafaret.Dict({'x': trafaret.String()})\n\n try:\n config = read_and_validate('config.yaml', TRAFARET)\n except ConfigError as e:\n e.output()\n sys.exit(1)\n\n\n\n.. _trafaret: http://github.com/Deepwalker/trafaret\n\nInstallation\n============\n\n::\n\n pip install trafaret-config==2.0.2\n\n\nLicense\n=======\n\nLicensed under either of\n\n* Apache License, Version 2.0,\n (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)\n at your option.\n\n------------\nContribution\n------------\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/tailhook/trafaret-config", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "trafaret-config", "package_url": "https://pypi.org/project/trafaret-config/", "platform": "", "project_url": "https://pypi.org/project/trafaret-config/", "project_urls": { "Homepage": "http://github.com/tailhook/trafaret-config" }, "release_url": "https://pypi.org/project/trafaret-config/2.0.2/", "requires_dist": null, "requires_python": "", "summary": "A configuration library for python using trafaret and yaml", "version": "2.0.2" }, "last_serial": 4268542, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "74d85def72663f6874038c51ae8fd937", "sha256": "aba4e46613d701951f8340ac60b5bdc869c9cad61330ef78e6cb4a699a9fe21c" }, "downloads": -1, "filename": "trafaret-config-0.1.0.tar.gz", "has_sig": false, "md5_digest": "74d85def72663f6874038c51ae8fd937", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3830, "upload_time": "2016-09-24T21:16:07", "url": "https://files.pythonhosted.org/packages/c2/0d/b068243aa5af072bcec108856ace63fc22e9da364ec97f8623eac10fea64/trafaret-config-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "474379e3574c14f6db030dc8fbf8d169", "sha256": "9a199b458bd4ffb620bd27980d2010558e6f101c82fb4f1beaaf3e886ff696dd" }, "downloads": -1, "filename": "trafaret-config-0.1.1.tar.gz", "has_sig": false, "md5_digest": "474379e3574c14f6db030dc8fbf8d169", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4127, "upload_time": "2016-09-26T09:58:46", "url": "https://files.pythonhosted.org/packages/b7/c0/c1565130d129b1908abdd077bc9624d3fae1d17cf53d5e2ba99b207ff209/trafaret-config-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "7af678c097ae1959a8c828f2b0ccec1f", "sha256": "8a1c3b8f8734e7e58db8b3823399341aa1a51e14b49251eba87ae21796892632" }, "downloads": -1, "filename": "trafaret-config-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7af678c097ae1959a8c828f2b0ccec1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4178, "upload_time": "2016-11-12T23:32:07", "url": "https://files.pythonhosted.org/packages/76/64/f7c7016a1e629d27cbc0f9d22aae7c62a55a79d026eeb33227c3a448107b/trafaret-config-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "66a82fa8a63effcb74c06c2c964d82e3", "sha256": "01477a5bf885eb2c598c8b57618f9cba13ff0d59ddc115d11e7d7a6be6da4925" }, "downloads": -1, "filename": "trafaret-config-1.0.1.tar.gz", "has_sig": false, "md5_digest": "66a82fa8a63effcb74c06c2c964d82e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4471, "upload_time": "2016-12-03T19:19:14", "url": "https://files.pythonhosted.org/packages/ad/2d/c69984e2cfb339d2b5120c581e6decc8623560828d76288ae3c1c839cb8d/trafaret-config-1.0.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "60d103ea3aa38f198f647efbac628ba1", "sha256": "ddfa70615b490ce0a34fa0ad9f8e05817b5caa4bb12fc694816562439873ba61" }, "downloads": -1, "filename": "trafaret-config-2.0.0.tar.gz", "has_sig": false, "md5_digest": "60d103ea3aa38f198f647efbac628ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5809, "upload_time": "2018-07-07T15:13:02", "url": "https://files.pythonhosted.org/packages/d9/2b/0d6d833f58e290cf4a59aa2d4869e1ea1e7496a46cf2e54adc0200492625/trafaret-config-2.0.0.tar.gz" } ], "2.0.0b2": [ { "comment_text": "", "digests": { "md5": "b8415ca8635b8b56f08e609c9c2de0f4", "sha256": "45e3974fc77edc607f5fce7d571b921a155761c484ce69d194debcef66bc8ecc" }, "downloads": -1, "filename": "trafaret-config-2.0.0b2.tar.gz", "has_sig": false, "md5_digest": "b8415ca8635b8b56f08e609c9c2de0f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5825, "upload_time": "2018-07-07T08:20:54", "url": "https://files.pythonhosted.org/packages/d8/e3/986cb01af7aa55377736d2228decf204231c8f4b6fff1a45981eae2312b6/trafaret-config-2.0.0b2.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "22d119199b25d701a7432585f591f9d2", "sha256": "db578e24e9211fba18352096754da4853c9246cbfc01e0e8ee36368a233c9810" }, "downloads": -1, "filename": "trafaret-config-2.0.1.tar.gz", "has_sig": false, "md5_digest": "22d119199b25d701a7432585f591f9d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6204, "upload_time": "2018-07-07T15:41:14", "url": "https://files.pythonhosted.org/packages/4a/a3/a1886b4a3355175bf35a849f61e9fea04ae0568102a7fcb5fdbf0e8a3441/trafaret-config-2.0.1.tar.gz" } ], "2.0.1b2": [ { "comment_text": "", "digests": { "md5": "1c9f06595122693e67153939a02f62de", "sha256": "710add0465170a9102d8be01c7f8c6fa6c633c7fc471ca8891fb0e22bcc5c526" }, "downloads": -1, "filename": "trafaret-config-2.0.1b2.tar.gz", "has_sig": false, "md5_digest": "1c9f06595122693e67153939a02f62de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6203, "upload_time": "2018-07-07T15:32:14", "url": "https://files.pythonhosted.org/packages/08/eb/bdd0a20c907deee937c3122a1b7f04c20471513ba9b5bd5f237ed6354ee1/trafaret-config-2.0.1b2.tar.gz" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "b5991b1753e605d786cfecb03b087908", "sha256": "440b6b49e5e975f9a640a2519abb2feddd96eb2aeb1715f87f947a7a079f20be" }, "downloads": -1, "filename": "trafaret-config-2.0.2.tar.gz", "has_sig": false, "md5_digest": "b5991b1753e605d786cfecb03b087908", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6195, "upload_time": "2018-09-13T12:10:08", "url": "https://files.pythonhosted.org/packages/08/6e/4072cf1e3e04b703911c36603c08efc030d0b1b19bf2ad9c1e0fff691097/trafaret-config-2.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b5991b1753e605d786cfecb03b087908", "sha256": "440b6b49e5e975f9a640a2519abb2feddd96eb2aeb1715f87f947a7a079f20be" }, "downloads": -1, "filename": "trafaret-config-2.0.2.tar.gz", "has_sig": false, "md5_digest": "b5991b1753e605d786cfecb03b087908", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6195, "upload_time": "2018-09-13T12:10:08", "url": "https://files.pythonhosted.org/packages/08/6e/4072cf1e3e04b703911c36603c08efc030d0b1b19bf2ad9c1e0fff691097/trafaret-config-2.0.2.tar.gz" } ] }