{ "info": { "author": "laike9m", "author_email": "laike9m@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.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "ezcf\r\n====\r\n\r\n|Build Status| |Supported Python versions| |PyPI version| |Coverage\r\nStatus|\r\n\r\nezcf stands for **easy configuration**, it allows you to import\r\nJSON/YAML/INI/XML like .py files. It is useful whenever you need to read\r\nfrom these formats, especially for reading configuration files.\r\n\r\nOK, stop talking, show us some code!\r\n\r\nOn the left is what you'll normally do, on the right is the ezcf way.\r\n**All you need is ``import ezcf`` first, then ``import filename``\r\nwithout extension.** Nothing else!\r\n\r\n.. figure:: https://github.com/laike9m/ezcf/raw/master/code_compare.png\r\n :alt: \r\n\r\nFor instance, here we want to load file ``config.json``. With a single\r\nline of code ``from config import *``, everything is done and you're\r\nhappy.\r\n\r\nInstall\r\n-------\r\n\r\n::\r\n\r\n pip install ezcf\r\n\r\nIf you run into ``error: yaml.h: No such file or directory``, don't\r\nworry, you can still use ezcf without any problem.\r\n\r\nSupported File Types\r\n--------------------\r\n\r\nezcf supports ``JSON``, ``YAML``, ``INI`` and ``XML`` with extension\r\n``json``, ``yaml``, ``yml``, ``ini``, ``xml``.\r\n\r\nSample Usage\r\n------------\r\n\r\nLet's start with an easy case:\r\n\r\n::\r\n\r\n \u251c\u2500\u2500 sample1.py\r\n \u2514\u2500\u2500 sample1.json \r\n\r\n``sample1.py`` and ``sample1.json`` are in the same directory. We want\r\nto read ``sample1.json`` in ``sample1.py``, here's how:\r\n\r\n.. code:: python\r\n\r\n \"\"\"\r\n # sample1.json\r\n {\r\n \"hello\": \"world\"\r\n }\r\n \"\"\"\r\n\r\n # sample1.py\r\n import ezcf\r\n from sample1 import hello\r\n\r\n print(hello) # 'world'\r\n\r\nIt's that easy.\r\n\r\n That's cool, but we usually put config files in a separate folder. Can\r\nezcf deal with that?\r\n\r\n::\r\n\r\n \u251c\u2500\u2500 conf\r\n \u2502 \u251c\u2500\u2500 __init__.py\r\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 sample2.yaml\r\n \u2514\u2500\u2500 sample2.py\r\n\r\nWhy not?\r\n\r\n.. code:: python\r\n\r\n \"\"\"sample2.yaml\r\n ---\r\n Time: 2001-11-23 15:02:31 -5\r\n User: ed\r\n warning:\r\n This is a warning.\r\n ---\r\n Stack:\r\n - file: TopClass.py\r\n line: 23\r\n code: |\r\n x = MoreObject(\"345\\n\")\r\n - file: MoreClass.py\r\n line: 58\r\n code: |-\r\n foo = bar\r\n \"\"\"\r\n\r\n # sample2.py\r\n import ezcf\r\n from conf.sample2 import Time, User, warning, Stack\r\n\r\n Time # datetime.datetime(2001, 11, 23, 20, 2, 31)\r\n User # ed\r\n warning # This is a warning.\r\n Stack # [{'line': 23, 'code': 'x = MoreObject(\"345\\\\n\")\\n', 'file': 'TopClass.py'}, {'line': 58, 'code': 'foo = bar', 'file': 'MoreClass.py'}]\r\n\r\nezcf supports all kinds of valid import statements. These statements are\r\nequivalent:\r\n\r\n.. code:: python\r\n\r\n from conf.sample2 import Time, User, warning, Stack\r\n from conf.sample2 import *\r\n import conf.sample2 # then use conf.sample2.Time/User/warning/Stack\r\n import conf.sample2 as cs # then use cs.Time/User/warning/Stack\r\n\r\nIn a word, you can assume they're just regular python files.(Currently\r\nezcf only supports files with utf-8 encoding)\r\n\r\nWhat about relative import? Yes, ezcf supports relative import, as long\r\nas you use it *correctly*.\r\n\r\nNote\r\n----\r\n\r\n1. Be careful importing YAML which contains multiple documents: if there\r\n exists keys with the same name, only one of them will be loaded. So\r\n it's better not to use multiple documents;\r\n2. All values in ``.ini`` files are kept as it is and loaded as a\r\n string;\r\n3. Since XML only allows single root, the whole xml will be loaded as\r\n one dict with root's name as variable name;\r\n4. Use `**valid variable\r\n names** `__,\r\n this means key strings in JSON/YAML/INI/XML should be valid Python\r\n variable name. Invalid variable name won't do any harm to your\r\n program nor will it crash, but you can't use them as expected.\r\n\r\nRun Tests\r\n---------\r\n\r\n::\r\n\r\n python setup.py test\r\n\r\nRoadmap\r\n-------\r\n\r\n- [x] Use dot to seperate folder/subfolder/file\r\n- [x] Unicode support\r\n- [x] JSON support\r\n- [x] YAML support\r\n- [x] INI support\r\n- [x] XML support\r\n- [ ] Auto encoding detect?\r\n- [x] CI\r\n- [x] coverage\r\n- [x] pypi\r\n\r\nLicense\r\n-------\r\n\r\nMIT\r\n\r\n.. |Build Status| image:: https://travis-ci.org/laike9m/ezcf.svg\r\n :target: https://travis-ci.org/laike9m/ezcf\r\n.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/ezcf.svg\r\n :target: https://pypi.python.org/pypi/ezcf/\r\n.. |PyPI version| image:: https://badge.fury.io/py/ezcf.svg\r\n :target: http://badge.fury.io/py/ezcf\r\n.. |Coverage Status| image:: https://coveralls.io/repos/laike9m/ezcf/badge.svg\r\n :target: https://coveralls.io/r/laike9m/ezcf", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/laike9m/ezcf/", "keywords": "config,import,JSON,YAML,INI,XML", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ezcf", "package_url": "https://pypi.org/project/ezcf/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ezcf/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/laike9m/ezcf/" }, "release_url": "https://pypi.org/project/ezcf/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Import JSON/YAML/INI/XML like .py files", "version": "0.2.1" }, "last_serial": 1772813, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "5787e74e02f642b88d635ace1b28d636", "sha256": "0a685d0ea3c97fb89bf445a2e2b484fa1c1b55fb854425c2d3fc1dbaecc652cc" }, "downloads": -1, "filename": "ezcf-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5787e74e02f642b88d635ace1b28d636", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7393, "upload_time": "2015-03-31T03:32:53", "url": "https://files.pythonhosted.org/packages/5d/73/928f65520e73fd4b0c2a346c98d1af01b6dbe4c5543ba1666186618a32bb/ezcf-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8ac7973f9b2c1cf4280e62690a67cc2", "sha256": "7d31d0a5229c0e0096da742407e5c40008488c7efa5ff3acdf91924ae44f1dde" }, "downloads": -1, "filename": "ezcf-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f8ac7973f9b2c1cf4280e62690a67cc2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5733, "upload_time": "2015-03-31T03:32:48", "url": "https://files.pythonhosted.org/packages/0a/bd/ed9093c55e8cfe9352171455a377c8da0d24d5fcb3415660cb069e57ad1f/ezcf-0.0.1.tar.gz" } ], "0.0.1.dev1": [ { "comment_text": "", "digests": { "md5": "13fe57dca26bd183363d4aeafd9068f2", "sha256": "b698df840a9d303f8113b7bd70f5f6d5c8ccf99a475f0248a36133949fa27931" }, "downloads": -1, "filename": "ezcf-0.0.1.dev1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "13fe57dca26bd183363d4aeafd9068f2", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6682, "upload_time": "2015-03-24T03:44:34", "url": "https://files.pythonhosted.org/packages/1e/e4/46ad27c2f86d5b50ab9372920f793750f1a96ee55eebee578d0fb20617f6/ezcf-0.0.1.dev1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c56fdab5cb1241cc356fc876c5167a2", "sha256": "303436a0d6fb5f5ea558d92030b27ef6d0a4e25a3e50c44aac9b5b177f60aefc" }, "downloads": -1, "filename": "ezcf-0.0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "0c56fdab5cb1241cc356fc876c5167a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5184, "upload_time": "2015-03-24T03:44:23", "url": "https://files.pythonhosted.org/packages/25/db/f171f7fdfc6c393465b567f898f657dd06cb8c11f343b2fe1863267f22ca/ezcf-0.0.1.dev1.tar.gz" } ], "0.0.1.post1": [ { "comment_text": "", "digests": { "md5": "401345a8f0698b212b8aec32a0a3a206", "sha256": "e062819694b9acadb38cd88133f9013e6e2cd97ad73ee290cafac2e1c3a3fdb9" }, "downloads": -1, "filename": "ezcf-0.0.1.post1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "401345a8f0698b212b8aec32a0a3a206", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 7434, "upload_time": "2015-03-31T06:42:00", "url": "https://files.pythonhosted.org/packages/82/10/88cb8e5db6b417226f740d50f0082da831f082694f471349b03c588c7254/ezcf-0.0.1.post1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb86b5097e5c71abd54a06390357dfb0", "sha256": "22416d9e3985b161f1f8892bd30be0b698df45fd3ea3b1130863d516d4133ac1" }, "downloads": -1, "filename": "ezcf-0.0.1.post1.zip", "has_sig": false, "md5_digest": "fb86b5097e5c71abd54a06390357dfb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9095, "upload_time": "2015-04-01T16:03:02", "url": "https://files.pythonhosted.org/packages/77/18/bebda2deb7b6ad2624c3a72745d9011d046bab632d4f0dfc8de140544318/ezcf-0.0.1.post1.zip" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "6066ce46824e03ac7c7db0baa0764409", "sha256": "351df38ff4680060dfeb0cb583671c58437543ddef3f94a38577bf94c9c0b249" }, "downloads": -1, "filename": "ezcf-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6066ce46824e03ac7c7db0baa0764409", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8256, "upload_time": "2015-04-05T06:07:06", "url": "https://files.pythonhosted.org/packages/ae/3f/76a4bce117dee1086bd347d4d521b8d4bd35d75ba1e691607da632e99d63/ezcf-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "997506b704fec26e89db17d38c3f3b30", "sha256": "f3918bdaac480cb7b65690e9d6c05b71cce02453ebb0676e16f4ba0688161034" }, "downloads": -1, "filename": "ezcf-0.0.2.tar.gz", "has_sig": false, "md5_digest": "997506b704fec26e89db17d38c3f3b30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6628, "upload_time": "2015-04-05T06:07:01", "url": "https://files.pythonhosted.org/packages/6f/d6/8ca9670b9843212973ffb1a388d8f713b103cd8c46add0e74fe2e1ea6705/ezcf-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "f1fbaeef1fdcda8e73a89e3a4d38467f", "sha256": "f9cb91a17ee271a7f9c4af45fe9b2acfb13612170ffc63ff61db1eb14097ed15" }, "downloads": -1, "filename": "ezcf-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1fbaeef1fdcda8e73a89e3a4d38467f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8651, "upload_time": "2015-04-05T15:51:52", "url": "https://files.pythonhosted.org/packages/99/ae/75f29159f0f38f02c62f9c124bfb0e4ab29ec522f315e8221d07620b73c4/ezcf-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a90ad12cf2202539a4cc097a6ff461e0", "sha256": "158378e6dae44a79f90c43a071899f0259e0613e2729b55987f46784ed36c863" }, "downloads": -1, "filename": "ezcf-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a90ad12cf2202539a4cc097a6ff461e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6837, "upload_time": "2015-04-05T15:51:48", "url": "https://files.pythonhosted.org/packages/16/5b/309396b2e2fe06c64520e22a7196c2551b160d7abfcc603ef751ea6490fd/ezcf-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ff456720248249a568a92d6f40b00de7", "sha256": "b073390b03f3666535595a999b72b0c25c6418746f1331d6034845c911427cb6" }, "downloads": -1, "filename": "ezcf-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ff456720248249a568a92d6f40b00de7", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 9544, "upload_time": "2015-04-11T14:59:47", "url": "https://files.pythonhosted.org/packages/86/bc/26dc04efa341287b1fbcf8c7fd46ba25bdc63c983417e2495ac4312f9aae/ezcf-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5d14b96aeff2c1f80f7a7adbbe341953", "sha256": "2d097601958ce2df7b2327c53c3090d4bcca1528af1b4350c8b18570b914fa31" }, "downloads": -1, "filename": "ezcf-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5d14b96aeff2c1f80f7a7adbbe341953", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7407, "upload_time": "2015-04-11T14:59:41", "url": "https://files.pythonhosted.org/packages/84/68/fa5be0ae3cdd774169f84c871141da69d8b1ab1e4832e0273de3b6ac2e67/ezcf-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "c6472105be003c38067649dfb96d0fed", "sha256": "6cbc350c55b54f5305bef49eb9295a04a0accd2dbb64edc758086062b45aa96a" }, "downloads": -1, "filename": "ezcf-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c6472105be003c38067649dfb96d0fed", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10493, "upload_time": "2015-10-17T05:36:35", "url": "https://files.pythonhosted.org/packages/b1/ed/0acfd2e48775721ccf73388f86bfb69dbe5cff97e302d65011868c84fa3b/ezcf-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e046b125e4b7e2df7754610b9e865e84", "sha256": "63ebeaac98352c2b4fd6c059aab3ff8d053208dcf60c9e6ac00936127f01412f" }, "downloads": -1, "filename": "ezcf-0.2.1.zip", "has_sig": false, "md5_digest": "e046b125e4b7e2df7754610b9e865e84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13469, "upload_time": "2015-10-17T05:36:28", "url": "https://files.pythonhosted.org/packages/55/bc/c7621782bcf54b8f860449c346892980b00fd5378a271330d15dde5b65c0/ezcf-0.2.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c6472105be003c38067649dfb96d0fed", "sha256": "6cbc350c55b54f5305bef49eb9295a04a0accd2dbb64edc758086062b45aa96a" }, "downloads": -1, "filename": "ezcf-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c6472105be003c38067649dfb96d0fed", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10493, "upload_time": "2015-10-17T05:36:35", "url": "https://files.pythonhosted.org/packages/b1/ed/0acfd2e48775721ccf73388f86bfb69dbe5cff97e302d65011868c84fa3b/ezcf-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e046b125e4b7e2df7754610b9e865e84", "sha256": "63ebeaac98352c2b4fd6c059aab3ff8d053208dcf60c9e6ac00936127f01412f" }, "downloads": -1, "filename": "ezcf-0.2.1.zip", "has_sig": false, "md5_digest": "e046b125e4b7e2df7754610b9e865e84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13469, "upload_time": "2015-10-17T05:36:28", "url": "https://files.pythonhosted.org/packages/55/bc/c7621782bcf54b8f860449c346892980b00fd5378a271330d15dde5b65c0/ezcf-0.2.1.zip" } ] }