{ "info": { "author": "Slavek Kabrda", "author_email": "slavek.kabrda@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "anymarkup\n=========\n\n.. image:: https://travis-ci.org/bkabrda/anymarkup.svg?branch=master\n :target: https://travis-ci.org/bkabrda/anymarkup\n :alt: Build Status\n\n.. image:: https://landscape.io/github/bkabrda/anymarkup/master/landscape.svg?style=flat\n :target: https://landscape.io/github/bkabrda/anymarkup/master\n :alt: Code Health\n\n.. image:: https://coveralls.io/repos/bkabrda/anymarkup/badge.svg?branch=master\n :target: https://coveralls.io/r/bkabrda/anymarkup?branch=master\n :alt: Coverage\n\nParse or serialize any markup. Currently supports ini, json, json5, toml, xml and yaml.\nReport bugs and new functionality requests at https://github.com/bkabrda/anymarkup/issues.\n\nParsing::\n\n >>> import anymarkup\n >>> anymarkup.parse('foo: bar')\n {'foo': 'bar'}\n >>> anymarkup.parse_file('foo/bar.ini')\n {'section': {'subsection': {'opt2': 'bar'}, 'opt1': 'foo'}}\n\n $ cat foo/bar.ini\n [section]\n opt1=foo\n [[subsection]]\n opt2=bar\n\nSerializing::\n\n >>> import anymarkup\n >>> anymarkup.serialize({'foo': 'bar'}, 'json')\n b'{\\n \"foo\": \"bar\"\\n}'\n >>> anymarkup.serialize_file({'foo': 'bar'}, 'foo/bar.json')\n\n $ cat foo/bar.json\n {\n \"foo\": \"bar\"\n }\n\n``anymarkup`` is licensed under BSD license. You can download official releases\nfrom https://pypi.python.org/pypi/anymarkup or install them via ``pip install anymarkup``.\n\n``anymarkup`` works with Python 2.7 and >= 3.3.\n\nAutomatic Markup Language Recognition\n-------------------------------------\n\nWhen using ``anymarkup.parse(input)``, anymarkup will try to guess markup language of input.\nThis usually works fine except:\n\n* ini vs toml: These two look almost the same and in fact have common subset (which,\n however, yields different parsing result). Because of this, anything with an ini-like\n look will be parsed with ini parser. If you want an input string to be parsed as toml,\n you have to explicitly specify that using ``format=toml`` (see below for examples).\n* json vs json5: json5 is superset of json, but not very widely used. Because of practicality\n of json usage, everything that looks like json is parsed as json. If you want input string\n to be parsed as json5, you have to explicitly specify that using ``format=json5``.\n\nWhen using ``anymarkup.parse_file(path)``, anymarkup will try to guess format based on file\nextension and then fallback to guessing as explained above. This means that if the file has\n``.toml`` pr ``.json5`` extension, you don't have to provide ``format=`` explicitly.\n\nNotes on Parsing Basic Types\n----------------------------\n\nWhen parsing, ``anymarkup`` recognizes basic types - ``NoneType``, ``int``, ``float`` and ``bool``\n(and ``long`` on Python 2) and converts all values to these types. If you want to get\neverything as strings, just use ``force_types=False`` with ``parse`` or ``parse_file``. Finally,\nyou can also use ``force_types=None`` to get whatever the parsing backend returned::\n\n >>> anymarkup.parse('a: 1')\n {'a': 1}\n >>> anymarkup.parse('a: 1', force_types=False)\n {'a': '1'}\n >>> anymarkup.parse('a: 1', force_types=None)\n {'a': 1}\n\n\nCLI\n--------\nTo install the CLI, run the following command:\n\n pip install anymarkup\n\nExample of conversion from JSON to XML:\n\n anymarkup convert --from-format json --to-format xml \n \n bar\n \"\"\"\n\n yaml = \"\"\"\n a:\n foo: bar\n \"\"\"\n\n # these will all yield the same value (except that xml parsing will yield OrderedDict)\n anymarkup.parse(ini)\n anymarkup.parse(json)\n anymarkup.parse(xml)\n anymarkup.parse(yaml)\n\n # explicitly specify a type of format to expect and/or encoding (utf-8 is default)\n anymarkup.parse('foo: bar', format='yaml', encoding='ascii')\n\n # by default, anymarkup recognizes basic types (None, booleans, ints and floats)\n # if you want to get everything as strings, just use force_types=False\n\n # will yield {'a': 1, 'b': True, 'c': None}\n anymarkup.parse('a: 1\\nb: True\\nc: None')\n # will yield {'a': '1', 'b': 'True', 'c': 'None'}\n anymarkup.parse('a: 1\\nb: True\\nc: None', force_types=False)\n\n # or parse a file\n anymarkup.parse_file('foo.ini')\n\n # if a file doesn't have a format extension, pass it explicitly\n anymarkup.parse_file('foo', format='json')\n\n # you can also pass encoding explicitly (utf-8 is default)\n anymarkup.parse_file('bar', format='xml', encoding='ascii')\n\n\nSerializing examples::\n\n struct = {'a': ['b', 'c']}\n\n for fmt in ['ini', 'json', 'xml', 'yaml']:\n # any of the above formats can be used for serializing\n anymarkup.serialize(struct, fmt)\n\n # explicitly specify encoding (utf-8 is default)\n anymarkup.serialize(struct, 'json', encoding='utf-8')\n\n # or serialize directly to a file\n anymarkup.serialize_file(struct, 'foo/bar.ini')\n\n # if a file doesn't have a format extension, pass it explicitly\n anymarkup.serialize_file(struct, 'foo/bar', format='json')\n\n # you can also pass encoding explicitly (utf-8 is default)\n anymarkup.serialize_file(struct, 'foo/bar', format='json', encoding='ascii')", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bkabrda/anymarkup", "keywords": "xml,yaml,toml,json,json5,ini", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "anymarkup", "package_url": "https://pypi.org/project/anymarkup/", "platform": "", "project_url": "https://pypi.org/project/anymarkup/", "project_urls": { "Homepage": "https://github.com/bkabrda/anymarkup" }, "release_url": "https://pypi.org/project/anymarkup/0.8.1/", "requires_dist": null, "requires_python": "", "summary": "Parse/serialize any markup format", "version": "0.8.1" }, "last_serial": 5581797, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e092546aa92848b0aa10074144576c2f", "sha256": "51c312bad499b853078ca1332bb7e664a2c5b0dd78b05dcc502dfdefdf06d157" }, "downloads": -1, "filename": "anymarkup-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e092546aa92848b0aa10074144576c2f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6574, "upload_time": "2015-03-02T16:32:40", "url": "https://files.pythonhosted.org/packages/53/c5/5f12021e8406b863969271c41bee37657897a25fb640681380165280629a/anymarkup-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2573d25a69111eff268f0c72fc06c90c", "sha256": "e5e4e45aca9ef89eb9524cdb4a846c03246f48eac5c2a4a04e2a7ada0e1d52d5" }, "downloads": -1, "filename": "anymarkup-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2573d25a69111eff268f0c72fc06c90c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6502, "upload_time": "2015-03-02T17:15:45", "url": "https://files.pythonhosted.org/packages/25/40/dfbe1d08689b753dd7eb1b29421649f773a61ac33de79d676187f1c2177e/anymarkup-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "8d08d25a367143b7119edf6ebf5a114d", "sha256": "4c6542839fd9df83acf74706374f779606ba5a58f04f18a884ea7dea7f44f86c" }, "downloads": -1, "filename": "anymarkup-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8d08d25a367143b7119edf6ebf5a114d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9282, "upload_time": "2015-03-11T15:48:40", "url": "https://files.pythonhosted.org/packages/f5/99/30d2b08a7b611bb55207793fe337f90ca25efe7e90308d590f540c0b3340/anymarkup-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1e124a7297af113cdb4314674cab3e11", "sha256": "3962a6b343f29c97ff68cb638f6dbb4fcea720f4c7b13b8b91d60ce5a8b64c5c" }, "downloads": -1, "filename": "anymarkup-0.3.0.tar.gz", "has_sig": false, "md5_digest": "1e124a7297af113cdb4314674cab3e11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10323, "upload_time": "2015-03-11T19:08:15", "url": "https://files.pythonhosted.org/packages/7e/0d/2bbdfe37ac0d317b790e42f01245746a81684a0df7fae147abb49033f9d8/anymarkup-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "9fd75f6f31975a8a65ecb5c9f1e5f996", "sha256": "311268eae70f211ae4f34927f1f75c3a3ee7096a697d4b9b30d5e7a52ee2f61e" }, "downloads": -1, "filename": "anymarkup-0.3.1.tar.gz", "has_sig": false, "md5_digest": "9fd75f6f31975a8a65ecb5c9f1e5f996", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10470, "upload_time": "2015-03-27T13:36:34", "url": "https://files.pythonhosted.org/packages/f4/b6/e99ea6b37f7aa80f5ebd0853b33c6090eb7599203569ca899e4149d87cb6/anymarkup-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "b29ec2c2241fe69d9a0bffb93ce44979", "sha256": "0f72110f8c39c1768234fd136dc88c23d84f2112d9717e11d0805739f4661464" }, "downloads": -1, "filename": "anymarkup-0.4.0.tar.gz", "has_sig": false, "md5_digest": "b29ec2c2241fe69d9a0bffb93ce44979", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11701, "upload_time": "2015-04-14T00:33:11", "url": "https://files.pythonhosted.org/packages/fb/ae/4d0b31c8c420c77f36873f995c55ef34b9d0199ec724dd11046149b63e4f/anymarkup-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "55342262533ae90d80d40cd72f7ee003", "sha256": "e84c93f8b250aec4cb813b32dd3325ff4cdbdff2fc0ffd571077857ae706092d" }, "downloads": -1, "filename": "anymarkup-0.4.1.tar.gz", "has_sig": false, "md5_digest": "55342262533ae90d80d40cd72f7ee003", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11910, "upload_time": "2015-05-19T15:18:37", "url": "https://files.pythonhosted.org/packages/0d/03/9dfe6a3bd3d06d0127fe2913a1202f5bfe9cef3e6447e7e5821defe73d67/anymarkup-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "4818700784e15dd3dcb422745580c91f", "sha256": "de12e9e7512bfaa232c532f3bee2f19206711105773436ba3d6ac14141284ea5" }, "downloads": -1, "filename": "anymarkup-0.4.2.tar.gz", "has_sig": false, "md5_digest": "4818700784e15dd3dcb422745580c91f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12647, "upload_time": "2015-05-25T08:24:50", "url": "https://files.pythonhosted.org/packages/fd/4f/28147cc39157288061cb54e9e8b38bb342934efe158b133171787af52456/anymarkup-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "dc71872f40ce5f69a37993f556f3f7f0", "sha256": "d60b15d9631c2d898fc8dd6f84aaef332418197023374f8780aac4ee1fc2a96a" }, "downloads": -1, "filename": "anymarkup-0.4.3.tar.gz", "has_sig": false, "md5_digest": "dc71872f40ce5f69a37993f556f3f7f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12662, "upload_time": "2015-06-16T12:23:57", "url": "https://files.pythonhosted.org/packages/4e/45/a7cf3240b33d3401ef9aa206749b54381e346d974d6b064a932d3167f63b/anymarkup-0.4.3.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "fe6bf4befe3a3dbf97f4f56f20d984b5", "sha256": "bbe344a814b3b476f15a01a11c4a0ec075633e80585772ee96446776b50da855" }, "downloads": -1, "filename": "anymarkup-0.5.0.tar.gz", "has_sig": false, "md5_digest": "fe6bf4befe3a3dbf97f4f56f20d984b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5009, "upload_time": "2015-10-19T10:57:59", "url": "https://files.pythonhosted.org/packages/8f/e6/be981ceaf3404e2bb27e77723ae7203bde11c2d242a8e46f6ede6fb8ef51/anymarkup-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "419cb853a955c8ce1d3f83554be4bc38", "sha256": "a91ddc143dbeeefc702298a3008e1425b3289e4c7ea116eaba3bbfc02a818dd4" }, "downloads": -1, "filename": "anymarkup-0.6.0.tar.gz", "has_sig": false, "md5_digest": "419cb853a955c8ce1d3f83554be4bc38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5472, "upload_time": "2016-05-06T14:01:48", "url": "https://files.pythonhosted.org/packages/30/d3/a7d696af4233b9e75e3158e774ca085f8c881ae0f3b4df952966a18c8f6c/anymarkup-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "a68f6b4e02c67d1bd39bc1bc399389f3", "sha256": "641a14cf64cfc1f108d19fd286edab4c05bf6126a91b425c960505a7fcb6ae84" }, "downloads": -1, "filename": "anymarkup-0.7.0.tar.gz", "has_sig": false, "md5_digest": "a68f6b4e02c67d1bd39bc1bc399389f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5590, "upload_time": "2016-05-07T14:16:51", "url": "https://files.pythonhosted.org/packages/45/5d/309924a49723b774754a16b3cc0cd21f4e6d451cf79b1302bf8e55b08e08/anymarkup-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "08432b9c21748ddca271daf26916a69b", "sha256": "5c9fd53c680e05b795f9371bff9a98f48bdeaa57eb519acedd50b6d67ac9ff92" }, "downloads": -1, "filename": "anymarkup-0.8.0.tar.gz", "has_sig": false, "md5_digest": "08432b9c21748ddca271daf26916a69b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7500, "upload_time": "2019-07-23T11:58:21", "url": "https://files.pythonhosted.org/packages/bc/af/48d7ddf10c10560561dd8cf91661dce9ee10e7bcdddce8b6108f6c1b794c/anymarkup-0.8.0.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "25dc3d226bcbcce6d557ad20887238cf", "sha256": "d125c795bd47c5f7dd5ec6aedd0691f7aa7b9ed619fde87eb56ddff17ee3e844" }, "downloads": -1, "filename": "anymarkup-0.8.1.tar.gz", "has_sig": false, "md5_digest": "25dc3d226bcbcce6d557ad20887238cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7720, "upload_time": "2019-07-25T07:10:45", "url": "https://files.pythonhosted.org/packages/23/cd/33df5e9ce5dcf72a55e39432a0d6bbc77aa7857b536a063c368aa48bdd8f/anymarkup-0.8.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "25dc3d226bcbcce6d557ad20887238cf", "sha256": "d125c795bd47c5f7dd5ec6aedd0691f7aa7b9ed619fde87eb56ddff17ee3e844" }, "downloads": -1, "filename": "anymarkup-0.8.1.tar.gz", "has_sig": false, "md5_digest": "25dc3d226bcbcce6d557ad20887238cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7720, "upload_time": "2019-07-25T07:10:45", "url": "https://files.pythonhosted.org/packages/23/cd/33df5e9ce5dcf72a55e39432a0d6bbc77aa7857b536a063c368aa48bdd8f/anymarkup-0.8.1.tar.gz" } ] }