{ "info": { "author": "Geoffrey M. Poore", "author_email": "gpoore@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: Information Technology", "Intended Audience :: Science/Research", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "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", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Utilities" ], "description": "=====================================\n ``bespon`` package for Python\n=====================================\n\n\n\nThe ``bespon`` package for Python encodes and decodes data in the\n`BespON `_ format.\n\n\n\nBasic usage\n===========\n\nData is loaded in a manner analogous to Python's ``json`` module:\n\n* ``bespon.load()``\n* ``bespon.loads()``\n\nSimilarly, dumping data to a file or string:\n\n* ``bespon.dump(, )``\n* ``bespon.dumps()``\n\nAt the moment, only dumping in indentation-style syntax is possible. Support\nfor other styles is under development. Only dicts, lists, Unicode\nstrings, byte strings, floats, ints, bools, and ``None`` are currently\nsupported for dumping. Loading supports additional data types.\n\n\n\nLossless round-trip support\n===========================\n\nThere is also support for lossless round-tripping. Data can be loaded,\nvalues can be modified, and then data can be saved again with minimal\nimpact on the data file layout.\n\nData can be loaded from a file or string into an instance of the\n``RoundtripAst`` class.\n\n* ``bespon.load_roundtrip_ast()``\n* ``bespon.loads_roundtrip_ast()``\n\nThis class has two methods that allow data to be modified.\n\n* ``replace_val(, )`` This replaces the object currently located\n at ```` within the data with ````. ```` must be a list\n or tuple consisting of dict keys and list indices. ```` must currently be a Unicode string, float, int, or bool, and must have the same\n type as the object it is replacing.\n* ``replace_key(, )`` This replaces the dict key at the end of\n ```` with the new key ```` (which will map to the same value as\n the replaced key). ```` must be a Unicode string, int, or bool,\n and must have the same type as the object it is replacing.\n\nAfter data in a ``RoundtripAst`` instance has been modified, it may be encoded\nback into a string with the ``dumps()`` method. An example is shown below.\n\n::\n\n >>> ast = bespon.loads_roundtrip_ast(\"\"\"\n key.subkey.first = 123 # Comment\n key.subkey.second = 0b1101\n key.subkey.third = `literal \\string`\n \"\"\")\n >>> ast.replace_key(['key', 'subkey'], 'sk')\n >>> ast.replace_val(['key', 'sk', 'second'], 7)\n >>> ast.replace_val(['key', 'sk', 'third'], '\\\\another \\\\literal')\n >>> ast.replace_key(['key', 'sk', 'third'], 'fourth')\n >>> print(ast.dumps())\n\n key.sk.first = 123 # Comment\n key.sk.second = 0b111\n key.sk.fourth = `\\another \\literal`\n\nThis example illustrates several of BespON's round-trip capabilities.\n\n* Comments and layout are preserved exactly.\n* Key renaming works with key paths. Every time a key appears in key paths,\n it is renamed.\n* When a number is modified, the new value is expressed in the same base as\n the old value.\n* When a quoted string is modified, the new value is quoted in the same\n style as the old value (at least to the extent that this is practical).\n* As soon as a key is modified, the new key must be used for further\n modifications. The old key is invalid.\n\nCurrently, round-trip support is limited to changing the value of any Unicode\nstring, float, int, or bool, without changing the type. Support for changing\ndata types and for more general data manipulation will be added in the future.\n\n\n\nAdvanced loading and dumping\n============================\n\nThe loading and dumping functions support several keyword arguments to\ncustomize data handling.\n\n**Loading**\n\n* ``aliases`` (boolean, default ``True``): Allow aliases.\n* ``circular_references`` (boolean, default ``False``): Allow aliases to\n create circular references.\n* ``custom_parsers`` (dict, default ``None``): Replace the default parser\n for a specified type with a custom parser. For example, using\n ``custom_parsers={'int': float}`` would cause all integers to be parsed\n with the ``float()`` function.\n* ``extended_types`` (boolean, default ``False``): Enable preliminary support\n for ``set`` and ``odict`` tagged collections (for example, ``(set)> [1, 2,\n 3]``). Enable preliminary support for complex number literals and rational\n number literals. Complex numbers currently use the general form\n ``1.0+2.0i``, where the real part is optional, the imaginary unit is\n represented with ``i``, and numbers must be floats (either in decimal or hex\n form). Rational numbers use the form ``1/2``, where the numerator and\n denominator must both be decimal integers, and any sign must come before the\n fraction.\n* ``float_overflow_to_inf`` (boolean, default ``False``): Whether\n non-``inf`` floats are permitted to overflow into ``inf`` without raising an\n error.\n* ``integers`` (boolean, default ``True``): Whether integers are permitted.\n Otherwise they are interpreted as floats.\n* ``only_ascii_unquoted`` (boolean, default ``True``): Whether non-ASCII\n identifier-style strings are allowed unquoted.\n* ``only_ascii_source`` (boolean, default ``False``): Whether non-ASCII code\n points are allowed to appear literally in the source (without being\n represented via backslash-escapes).\n* ``python_types`` (boolean, default ``False``): Enable preliminary support\n for Python-specific data types. Currently this only supports ``tuple``.\n* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting\n depth for collections.\n\n**Dumping**\n\n* ``hex_floats`` (boolean, default ``False``): Whether floats are\n dumped in hex form.\n* ``max_nesting_depth`` (int, default ``100``): Maximum permitted nesting\n depth of collections.\n\n\n\nSpec conformance\n================\n\nThe ``bespon`` package passes the\n`BespON test suite `_.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/gpoore/bespon_py", "keywords": "configuration", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "BespON", "package_url": "https://pypi.org/project/BespON/", "platform": "", "project_url": "https://pypi.org/project/BespON/", "project_urls": { "Homepage": "http://github.com/gpoore/bespon_py" }, "release_url": "https://pypi.org/project/BespON/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "Python library for BespON", "version": "0.3.0" }, "last_serial": 3018841, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "736c8a0a23e95b8e2b11e4dd25ff2fbe", "sha256": "3b16ca1ae65919080a2ce6808ba5334edd295c04c9fb3dd418fc5987aafd6698" }, "downloads": -1, "filename": "BespON-0.1.0.tar.gz", "has_sig": false, "md5_digest": "736c8a0a23e95b8e2b11e4dd25ff2fbe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 53864, "upload_time": "2017-04-08T00:24:48", "url": "https://files.pythonhosted.org/packages/e0/4f/4d9c1755f4c1cda1782e6726cd49a64fce15ac7dcf77e6de1aa6b60c18f0/BespON-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "38759d233d271a7718c65ebd379901e6", "sha256": "33e9943985f56627800ea0d3e6a42cb5457e6d4d088cb4c4d8035f40b6954916" }, "downloads": -1, "filename": "BespON-0.1.1.tar.gz", "has_sig": false, "md5_digest": "38759d233d271a7718c65ebd379901e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55156, "upload_time": "2017-04-08T01:31:16", "url": "https://files.pythonhosted.org/packages/6b/53/aae93ae41c13250e11d754cf7a2a07f265169ec283f35acb110e48cf60d3/BespON-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "39dc992067e7cd81095155325fbefa07", "sha256": "3b79597e8387c8ca1b96853e641c596ee004bed19338ecd3a13a7a7208d02a55" }, "downloads": -1, "filename": "BespON-0.2.0.tar.gz", "has_sig": false, "md5_digest": "39dc992067e7cd81095155325fbefa07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 66271, "upload_time": "2017-06-08T19:44:36", "url": "https://files.pythonhosted.org/packages/43/c0/9b09c73245930251f3b23154c93c93e5a7e4bda6cc7d19b4984137f99499/BespON-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a15e4479cac7d702f71d13f424d7d089", "sha256": "9eeb09b61f67cf62907f906b97bf53e6afb46d66d0fcaa990b8a5e26aed872b0" }, "downloads": -1, "filename": "BespON-0.2.1.tar.gz", "has_sig": false, "md5_digest": "a15e4479cac7d702f71d13f424d7d089", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 67541, "upload_time": "2017-06-17T03:29:07", "url": "https://files.pythonhosted.org/packages/b3/96/24c77adc3378c6e2e954bcfbc6d5417c2780f0581eb0bfd44232aba42a38/BespON-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "e920c8ecd420f5cc747ef4a82bd2bc8d", "sha256": "fb44642747145ff0db671ec1d8b6a434584f5b7e8442878b2388213843df2819" }, "downloads": -1, "filename": "BespON-0.3.0.tar.gz", "has_sig": false, "md5_digest": "e920c8ecd420f5cc747ef4a82bd2bc8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 68965, "upload_time": "2017-07-12T22:24:24", "url": "https://files.pythonhosted.org/packages/8c/31/e00a41ea77bfb349987dd4b9b2ccb71b5900e8ff5a6c7ff60b2676c6c548/BespON-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e920c8ecd420f5cc747ef4a82bd2bc8d", "sha256": "fb44642747145ff0db671ec1d8b6a434584f5b7e8442878b2388213843df2819" }, "downloads": -1, "filename": "BespON-0.3.0.tar.gz", "has_sig": false, "md5_digest": "e920c8ecd420f5cc747ef4a82bd2bc8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 68965, "upload_time": "2017-07-12T22:24:24", "url": "https://files.pythonhosted.org/packages/8c/31/e00a41ea77bfb349987dd4b9b2ccb71b5900e8ff5a6c7ff60b2676c6c548/BespON-0.3.0.tar.gz" } ] }