{ "info": { "author": "Martin Ortbauer", "author_email": "mortbauer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Utilities" ], "description": "A simple but still powerfull Configuration Parser\n#################################################\n\n.. image:: https://secure.travis-ci.org/mortbauer/configreader.png?branch=master \n :target: https://secure.travis-ci.org/mortbauer/configreader\n\nThere are quite many Configuration Parsers for Python out there, but well, they\nall kind of suck in there own way. Let me point out what I dislike:\n\n* `configparser`_: which is the de facto standard, has it's ini like language, in\n my opionion quite awful, difficult and limited\n\n* Configuration through yaml: is beautiful, but how about intergration of\n simple environment variables or interpolation of already defined values\n\n* How about just execution a python module, very unsafe (but who cares), but it\n also pollutes the namespace with all sort of builtins and whatsoever\n\nSo I was looking once again and found `python-config`_, which looked really\nexactly what I wanted, but well, I had my problems with it, since I wanted to\nhave acces to stuff like `os.getenv('HOME')` and similar, which was not really\npossible since it was forbidden to call a function, though you could still\nevaluate stuff and so on. I looke into the source and thought well how can I\nallow also calling functions? But I realized they are defining there own\nparsing grammar, which seemed kind of reinventing the wheel since I already\nknew the `ast`_ module. \n\nFinally I wrote a very simple Configuration Parser which lets `ast`_ and\n`operator`_ do most of the work. It has of course its own problems, and is hack\nof half an hour so don't expect much. For me it is still usefull, and maybe we\ncan improve it.\n\nUsage \n*******\nAs a simple example of what is possible and how to use the module, see the\nfollowing config file which is by the way completely valid python::\n\n home = os.getenv('HOME')\n aster_root = home+\"/data/opt/aster\"\n project = \"bikeframe-test\"\n version = \"testing\"\n # source directory for all files if relative path\n srcdir = \".\"\n # output directory for all stuff\n outdir = \"results\"\n # input mesh file\n meshfile = \"mesh.med\"\n logfile = \"asterclient.log\"\n workdir = \"/data/tmp\"\n # define the studies\n calculations = [\n {\"name\":\"main\",\n \"commandfile\": \"main.comm\",\n \"resultfiles\":{\n \"bikeframe.rmed\":80,\n \"bikeframe.msh\": 81,\n \"buckling.rmed\": 82,\n \"bikeframe.table\": 39,\n \"bikeframe.resu\": 38,\n \"buckling.resu\": 37,\n },\n \"inputfiles\":[\"parameters.py\"],\n },\n {\"name\": \"post\",\n \"commandfile\":\"post.comm\",\n \"poursuite\": \"main\",\n \"resultfiles\":{\n \"vmises.table\": 40,\n \"protocol\": \"protocol*.rst\",\n }\n }]\n\nSuppose we have this saved as `profile.conf` we could read it like::\n\n import os\n from configreader import Config\n\n c = Config(open('profile.conf','r'),namespace={'os.getenv':os.getenv})\n\nwhich would give as all the values specified and evaluated as a python `dict`.\nIf we wouldn't have provided the namespace with `os.getenv` the parsing would\nhave failed since it only allows functions mapped in the namespace, so you have\ncompletele fine grained possibility on what to allow. \nAs input the `Config` class expects any file like object which is an object\nwith a read method.\n\nTesting\n*******\nThere are a few simple test cases in `tests` use best `py.test`_ to run them.\n\n.. _python-config: https://github.com/Inkvi/python-config\n.. _ast: http://docs.python.org/3.3/library/ast.html\n.. _operator: http://docs.python.org/3.3/library/operator.html\n.. _configparser: http://docs.python.org/3.3/library/configparser.html\n.. _py.test: https://pypi.python.org/pypi/pytest", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mortbauer/configreader", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "configreader", "package_url": "https://pypi.org/project/configreader/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/configreader/", "project_urls": { "Homepage": "https://github.com/mortbauer/configreader" }, "release_url": "https://pypi.org/project/configreader/0.0.6/", "requires_dist": null, "requires_python": null, "summary": "An easy-to-use, powerful configuration module for Python", "version": "0.0.6" }, "last_serial": 1244380, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "9b971211b646638e2fbef89b5c0b261e", "sha256": "f3958abc3d8a52b698bc92242eff402f0e3724e2bd3bfb78681ebce4b612eecc" }, "downloads": -1, "filename": "configreader-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9b971211b646638e2fbef89b5c0b261e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6564, "upload_time": "2014-09-29T11:30:43", "url": "https://files.pythonhosted.org/packages/e4/ac/f7b2c2f5cca121612d055edcb99051f1f40f33dde8c51b9c0d9352d5b41a/configreader-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c97723c036d62404229399b5668e38f", "sha256": "9526d1747c47d2e06933c164b9c607be906ceb4ce75ebbb8af1624cdde7cc278" }, "downloads": -1, "filename": "configreader-0.0.2.tar.gz", "has_sig": false, "md5_digest": "2c97723c036d62404229399b5668e38f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4243, "upload_time": "2014-09-29T11:25:18", "url": "https://files.pythonhosted.org/packages/f0/a2/6f796974d4ea167be3e015b5a39993185d261680c1916b95ce256444ab9f/configreader-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "ec33d491a30d8146b4a241b64d6874e4", "sha256": "ce3b24060b3215bcfce490541744fced7bfadba7f584a7e471a3d80ec711e5ca" }, "downloads": -1, "filename": "configreader-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ec33d491a30d8146b4a241b64d6874e4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7770, "upload_time": "2014-09-29T13:40:29", "url": "https://files.pythonhosted.org/packages/7e/df/15597d2170fe7c42b7a491f554a5d291fe500f0f227acd7e02f2a3a723aa/configreader-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "554e9e3980d394e354479177de0e75a1", "sha256": "4caa353fcfd6c24a07e819896e776379a232d1ef4cce6dcb138a32e4819ac93e" }, "downloads": -1, "filename": "configreader-0.0.3.tar.gz", "has_sig": false, "md5_digest": "554e9e3980d394e354479177de0e75a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4476, "upload_time": "2014-09-29T13:40:19", "url": "https://files.pythonhosted.org/packages/c3/1a/1d644b1a2c42f77513fc0eacaac538906cb8d7530550e8d4407aee944087/configreader-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3f5b1fd005f8f8fb88ea1652ef80367e", "sha256": "cfe864e0c424b5cfd5d2a392b2ad2262f35bf9d6f3b207d4eae6ba0d1a49d94e" }, "downloads": -1, "filename": "configreader-0.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "3f5b1fd005f8f8fb88ea1652ef80367e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8282, "upload_time": "2014-10-01T13:34:18", "url": "https://files.pythonhosted.org/packages/2d/4b/9f1b6261cbab75244a9a49f2b2f183c768e9c4996c7f3acea05cb61a3c6f/configreader-0.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9197f5d6f4e84fbef01b44e2a720770d", "sha256": "e3ca13cb2c2321560ebb592cea667a074638131c12ca89a02e8ce51d7340afd7" }, "downloads": -1, "filename": "configreader-0.0.4.tar.gz", "has_sig": false, "md5_digest": "9197f5d6f4e84fbef01b44e2a720770d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5029, "upload_time": "2014-10-01T13:34:31", "url": "https://files.pythonhosted.org/packages/eb/4c/507967aa23ea9da2e759a9dc93507631032d8b4dc5aaf05b380927a18271/configreader-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "a3fcfb3fabab9037aaec2b926cc4ca3c", "sha256": "96cc22e2243a2c776fe959d4dfe1b2fe7b4b6fd741425f5fefc43b1afe4a221f" }, "downloads": -1, "filename": "configreader-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a3fcfb3fabab9037aaec2b926cc4ca3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4320, "upload_time": "2014-10-01T13:39:53", "url": "https://files.pythonhosted.org/packages/e6/f9/7bcc37d8ca74ebfcbb20c807668c5dde87292c33a729685fbfcc3fdfc8e1/configreader-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "f88f8223756d6b42e051d409ed78dc6b", "sha256": "b67a96fa7f3cf08c7e6bafa8f3694b42cacb30cb246646f7a09e97b483a26063" }, "downloads": -1, "filename": "configreader-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "f88f8223756d6b42e051d409ed78dc6b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6882, "upload_time": "2014-10-01T13:41:35", "url": "https://files.pythonhosted.org/packages/58/72/31ddf74227900847cb23b6222b6be1ba0787e4b9863dd3a665c4e9c67a27/configreader-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8462b1d46734321158393111ec9ddcca", "sha256": "d1fcd6a539135137b15440574a68ec1545db8b823675282d2b1c28818e40b4e4" }, "downloads": -1, "filename": "configreader-0.0.6.tar.gz", "has_sig": false, "md5_digest": "8462b1d46734321158393111ec9ddcca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4317, "upload_time": "2014-10-01T13:41:25", "url": "https://files.pythonhosted.org/packages/22/eb/2b4fdbdd2cb026329368d2102fc41968dd318846dc83603dd43fb8f3433c/configreader-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f88f8223756d6b42e051d409ed78dc6b", "sha256": "b67a96fa7f3cf08c7e6bafa8f3694b42cacb30cb246646f7a09e97b483a26063" }, "downloads": -1, "filename": "configreader-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "f88f8223756d6b42e051d409ed78dc6b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6882, "upload_time": "2014-10-01T13:41:35", "url": "https://files.pythonhosted.org/packages/58/72/31ddf74227900847cb23b6222b6be1ba0787e4b9863dd3a665c4e9c67a27/configreader-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8462b1d46734321158393111ec9ddcca", "sha256": "d1fcd6a539135137b15440574a68ec1545db8b823675282d2b1c28818e40b4e4" }, "downloads": -1, "filename": "configreader-0.0.6.tar.gz", "has_sig": false, "md5_digest": "8462b1d46734321158393111ec9ddcca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4317, "upload_time": "2014-10-01T13:41:25", "url": "https://files.pythonhosted.org/packages/22/eb/2b4fdbdd2cb026329368d2102fc41968dd318846dc83603dd43fb8f3433c/configreader-0.0.6.tar.gz" } ] }