{ "info": { "author": "Christian Aichinger", "author_email": "Greek0@gmx.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "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 :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=======\nlibconf\n=======\n\nlibconf is a pure-Python reader/writer for configuration files in `libconfig\nformat`_, which is often used in C/C++ projects. It's interface is similar to\nthe `json`_ module: the four main methods are ``load()``, ``loads()``,\n``dump()``, and ``dumps()``.\n\nExample usage::\n\n import io, libconf\n >>> with io.open('example.cfg') as f:\n ... config = libconf.load(f)\n >>> config\n {'capabilities': {'can-do-arrays': [3, 'yes', True],\n 'can-do-lists': (True,\n 14880,\n ('sublist',),\n {'subgroup': 'ok'})},\n 'version': 7,\n 'window': {'position': {'h': 600, 'w': 800, 'x': 375, 'y': 210},\n 'title': 'libconfig example'}}\n\n >>> config['window']['title']\n 'libconfig example'\n >>> config.window.title\n 'libconfig example'\n\n >>> print(libconf.dumps({'size': [10, 15], 'flag': True}))\n flag = True;\n size =\n [\n 10,\n 15\n ];\n\nThe data can be accessed either via indexing (``['title']``) or via attribute\naccess ``.title``.\n\nCharacter encoding and escape sequences\n---------------------------------------\n\nThe recommended way to use libconf is with Unicode objects (``unicode`` on\nPython2, ``str`` on Python3). Input strings or streams for ``load()`` and\n``loads()`` should be Unicode, as should be all strings contained in data\nstructures passed to ``dump()`` and ``dumps()``.\n\nIn ``load()`` and ``loads()``, escape sequences (such as ``\\n``, ``\\r``,\n``\\t``, or ``\\xNN``) are decoded. Hex escapes (``\\xNN``) are mapped to Unicode\ncharacters U+0000 through U+00FF. All other characters are passed though as-is.\n\nIn ``dump()`` and ``dumps()``, unprintable characters below U+0080 are escaped\nas ``\\n``, ``\\r``, ``\\t``, ``\\f``, or ``\\xNN`` sequences. Characters U+0080\nand above are passed through as-is.\n\n\nWriting libconfig files\n-----------------------\n\nReading libconfig files is easy. Writing is made harder by two factors:\n\n* libconfig's distinction between `int and int64`_: ``2`` vs. ``2L``\n* libconfig's distinction between `lists`_ and `arrays`_, and\n the limitations on arrays\n\nThe first point concerns writing Python ``int`` values. Libconf dumps values\nthat fit within the C/C++ 32bit ``int`` range without an \"L\" suffix. For larger\nvalues, an \"L\" suffix is automatically added. To force the addition of an \"L\"\nsuffix even for numbers within the 32 bit integer range, wrap the integer in a\n``LibconfInt64`` class.\n\nExamples::\n\n dumps({'value': 2}) # Returns \"value = 2;\"\n dumps({'value': 2**32}) # Returns \"value = 4294967296L;\"\n dumps({'value': LibconfInt64(2)}) # Explicit int64, returns \"value = 2L;\"\n\nThe second complication arises from distinction between `lists`_ and `arrays`_\nin the libconfig language. Lists are enclosed by ``()`` parenthesis, and can\ncontain arbitrary values within them. Arrays are enclosed by ``[]`` brackets,\nand have significant limitations: all values must be scalar (int, float, bool,\nstring) and must be of the same type.\n\nLibconf uses the following convention:\n\n* it maps libconfig ``()``-lists to Python tuples, which also use the ``()``\n syntax.\n* it maps libconfig ``[]``-arrays to Python lists, which also use the ``[]``\n syntax.\n\nThis provides nice symmetry between the two languages, but has the drawback\nthat dumping Python lists inherits the limitations of libconfig's arrays.\nTo explicitly control whether lists or arrays are dumped, wrap the Python\nlist/tuple in a ``LibconfList`` or ``LibconfArray``.\n\nExamples::\n\n # Libconfig lists (=Python tuples) can contain arbitrary complex types:\n dumps({'libconf_list': (1, True, {})})\n\n # Libconfig arrays (=Python lists) must contain scalars of the same type:\n dumps({'libconf_array': [1, 2, 3]})\n\n # Equivalent, but more explit by using LibconfList/LibconfArray:\n dumps({'libconf_list': LibconfList([1, True, {}])})\n dumps({'libconf_array': LibconfArray([1, 2, 3])})\n\n\nComparison to other Python libconfig libraries\n----------------------------------------------\n\n`Pylibconfig2`_ is another pure-Python libconfig reader. It's API\nis based on the C++ interface, instead of the Python `json`_ module.\nIt's licensed under GPLv3, which makes it unsuitable for use in a large number\nof projects.\n\n`Python-libconfig`_ is a library that provides Python bindings for the\nlibconfig++ C++ library. While permissively licensed (BSD), it requires a\ncompilation step upon installation, which can be a drawback.\n\nI wrote libconf (this library) because both of the existing libraries didn't\nfit my requirements. I had a work-related project which is not open source\n(ruling out pylibconfig2) and I didn't want the deployment headache of\npython-libconfig. Further, I enjoy writing parsers and this seemed like a nice\nopportunity :-)\n\nRelease notes\n-------------\n\n* **2.0.0**, released on 2018-11-23\n\n - Output validation for ``dump()`` and ``dumps()``: raise an exception when\n dumping data that can not be read by the C libconfig implementation.\n *This change may raise exceptions on code that worked with <2.0.0!*\n - Add ``LibconfList``, ``LibconfArray``, ``LibconfInt64`` classes for\n more fine-grained control of the ``dump()``/``dumps()`` output.\n - Fix ``deepcopy()`` of ``AttrDict`` classes (thanks AnandTella).\n\n* **1.0.1**, released on 2017-01-06\n\n - Drastically improve performance when reading larger files\n - Several smaller improvements and fixes\n\n* **1.0.0**, released on 2016-10-26:\n\n - Add the ability to write libconf files (``dump()`` and ``dumps()``,\n thanks clarkli86 and eatsan)\n - Several smaller improvements and fixes\n\n* **0.9.2**, released on 2016-09-09:\n\n - Fix compatibility with Python versions older than 2.7.6 (thanks AnandTella)\n\n\n.. _libconfig format: http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files\n.. _json: https://docs.python.org/3/library/json.html\n.. _lists: https://hyperrealm.github.io/libconfig/libconfig_manual.html#Lists\n.. _arrays: https://hyperrealm.github.io/libconfig/libconfig_manual.html#Arrays\n.. _int and int64: https://hyperrealm.github.io/libconfig/libconfig_manual.html#g_t64_002dbit-Integer-Values\n.. _Pylibconfig2: https://github.com/heinzK1X/pylibconfig2\n.. _Python-libconfig: https://github.com/cnangel/python-libconfig\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/Grk0/python-libconf/tarball/2.0.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Grk0/python-libconf", "keywords": "libconfig configuration parser library", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "libconf", "package_url": "https://pypi.org/project/libconf/", "platform": "", "project_url": "https://pypi.org/project/libconf/", "project_urls": { "Download": "https://github.com/Grk0/python-libconf/tarball/2.0.0", "Homepage": "https://github.com/Grk0/python-libconf" }, "release_url": "https://pypi.org/project/libconf/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "A pure-Python libconfig reader/writer with permissive license", "version": "2.0.0" }, "last_serial": 4521588, "releases": { "0.9.1": [ { "comment_text": "", "digests": { "md5": "17693dc29b54ee3c3071ab8a346adeb3", "sha256": "ee3f3f296df5a358de033e04c8d7eacf7e5313d880ae1ef695c0960d4c5adf50" }, "downloads": -1, "filename": "libconf-0.9.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "17693dc29b54ee3c3071ab8a346adeb3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8307, "upload_time": "2016-04-15T18:57:55", "url": "https://files.pythonhosted.org/packages/83/e1/ca3263a5b702df34b5317af372cf56f63c2a9afcc734272fe507e98776bb/libconf-0.9.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e20f48a7621b8475c0501768f2b0ec6f", "sha256": "15b0a9c527357b02e5c6adb7d3a4637d15a7c952dec3dd2e613132a36bf89501" }, "downloads": -1, "filename": "libconf-0.9.1.zip", "has_sig": false, "md5_digest": "e20f48a7621b8475c0501768f2b0ec6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14023, "upload_time": "2016-04-15T18:58:00", "url": "https://files.pythonhosted.org/packages/fe/ff/5953dcd7923789c6cb0f7dd5643c37bb336183548a00eeb194eed06b72a1/libconf-0.9.1.zip" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "54bb6e2064a1816f5a932826759fb1a8", "sha256": "cb77c938405c212d666853cb80b54255972897857cd7d6da6acf96037a3f9f30" }, "downloads": -1, "filename": "libconf-0.9.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "54bb6e2064a1816f5a932826759fb1a8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8270, "upload_time": "2016-09-09T20:24:57", "url": "https://files.pythonhosted.org/packages/7e/02/313d2459be1c660a7b476fadd031141c89ef5e0d8e628ea93def7f0f9b2f/libconf-0.9.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b9577344897290025e25ee5813e7433", "sha256": "eb279776b6ac3c46e4143120700ef9aee00191594e2e5c542ac084f11daa4624" }, "downloads": -1, "filename": "libconf-0.9.2.zip", "has_sig": false, "md5_digest": "6b9577344897290025e25ee5813e7433", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13915, "upload_time": "2016-09-09T20:25:00", "url": "https://files.pythonhosted.org/packages/43/44/bd17556a5179bdf8d2859bc3ac75df77ced3170c2d5ca26b81084157cc62/libconf-0.9.2.zip" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "e9aa978c442604530962ab18671c0402", "sha256": "5540121daf7223fcf45eac550623b7d3c321b3abfb166cbba978d251f1932345" }, "downloads": -1, "filename": "libconf-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e9aa978c442604530962ab18671c0402", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10599, "upload_time": "2016-10-26T17:26:03", "url": "https://files.pythonhosted.org/packages/f9/63/ad20fd8cff3b67b10394110b0b3b62be3fe0a11d4a580282c42a2d38913b/libconf-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a07c6f44c75a7d8330167f46a79033a3", "sha256": "bbe41b6159558ca0e013ba6b4f08fffe8f0d168691a00b9836e5b06a9fc757eb" }, "downloads": -1, "filename": "libconf-1.0.0.zip", "has_sig": false, "md5_digest": "a07c6f44c75a7d8330167f46a79033a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18190, "upload_time": "2016-10-26T17:26:06", "url": "https://files.pythonhosted.org/packages/07/6a/4e31b8f805741db44812dccb8d4d5837d2c35a47061d5ecb5920c9b59814/libconf-1.0.0.zip" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "99621cbeeb14872f29a4b5d7883569a2", "sha256": "06a7107729bce8df985cd98f5ca5c65e3238893252e9ae3c2aae6b7b71fc8c83" }, "downloads": -1, "filename": "libconf-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "99621cbeeb14872f29a4b5d7883569a2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11116, "upload_time": "2017-01-06T13:00:34", "url": "https://files.pythonhosted.org/packages/bf/2a/eebafba3819655fcfd03ce1fdee53726139eb30339b2db7ade29a75eb01f/libconf-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d37d355b3248f99802c46669ba38e406", "sha256": "6dd62847bb69ab5a09155cb8be2328cce01e7ef88a35e7c37bea2b1a70f8bd58" }, "downloads": -1, "filename": "libconf-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d37d355b3248f99802c46669ba38e406", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12540, "upload_time": "2017-01-06T13:00:36", "url": "https://files.pythonhosted.org/packages/7c/70/e7780ef82bf2ee05a74f192083209139cd5a75404c6d5ff5c26ef1f20a93/libconf-1.0.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "2fc3bb8b898edd7e05f6dbb5f224c4e2", "sha256": "d43302f8a795487b968b3893f71cd93da3c9cbfdd660824df4d27ca6dd8e17cb" }, "downloads": -1, "filename": "libconf-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2fc3bb8b898edd7e05f6dbb5f224c4e2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10492, "upload_time": "2018-11-23T19:37:23", "url": "https://files.pythonhosted.org/packages/19/32/9e6f6078555c87c940c20c4fb8e99b8e7c95146af73bb0c2589bc39a74c5/libconf-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f99abe8134041277e6abf9714c10e3d4", "sha256": "4317bafc38ee7b1570dea609b58c805c4bcacf4110c15243bb38cebf7a53af18" }, "downloads": -1, "filename": "libconf-2.0.0.tar.gz", "has_sig": false, "md5_digest": "f99abe8134041277e6abf9714c10e3d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17718, "upload_time": "2018-11-23T19:37:24", "url": "https://files.pythonhosted.org/packages/f9/62/edd517dc7fbcb27a349ea5d2f34384d2c596068eeabe51ed9e6675d44c95/libconf-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2fc3bb8b898edd7e05f6dbb5f224c4e2", "sha256": "d43302f8a795487b968b3893f71cd93da3c9cbfdd660824df4d27ca6dd8e17cb" }, "downloads": -1, "filename": "libconf-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2fc3bb8b898edd7e05f6dbb5f224c4e2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10492, "upload_time": "2018-11-23T19:37:23", "url": "https://files.pythonhosted.org/packages/19/32/9e6f6078555c87c940c20c4fb8e99b8e7c95146af73bb0c2589bc39a74c5/libconf-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f99abe8134041277e6abf9714c10e3d4", "sha256": "4317bafc38ee7b1570dea609b58c805c4bcacf4110c15243bb38cebf7a53af18" }, "downloads": -1, "filename": "libconf-2.0.0.tar.gz", "has_sig": false, "md5_digest": "f99abe8134041277e6abf9714c10e3d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17718, "upload_time": "2018-11-23T19:37:24", "url": "https://files.pythonhosted.org/packages/f9/62/edd517dc7fbcb27a349ea5d2f34384d2c596068eeabe51ed9e6675d44c95/libconf-2.0.0.tar.gz" } ] }