{ "info": { "author": "Ricard Valverde", "author_email": "ricard.valverde@socialpoint.es", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Unity YAML Parser #\n![travis](https://travis-ci.org/socialpoint-labs/unity-yaml-parser.svg?branch=master)\n\nThis project aims to provide a python3 API to load and dump Unity YAML \nfiles(configurations, prefabs, scenes, serialized data, etc) in the exact same \nformat the internal Unity YAML serializer does.\n\nUsing this API you will be able to easily manipulate(as python objects) \nUnity YAML files and save them just the same, keeping the YAML structure\nexactly as Unity does. This has the advantages of, first not having to\nconfigure PyYAML beforehand to deal with Unity YAMLs, and second as the\nmodified file keeps the same structure and formatting that Unity does, \nwhen the YAML file is loaded by Unity it won't make formatting changes \nto it that will make any VCS report unexpected file changes.\n\n## Installing ##\n\nInstall and update using [pip](https://pip.pypa.io/en/stable/quickstart/):\n````\npip install -U unityparser\n````\n## A Simple Example ##\n````python\nfrom unityparser import UnityDocument\n\n# Loading and modifying a config file with a single YAML document\nproject_settings_file = 'UnityProject/ProjectSettings/ProjectSettings.asset'\ndoc = UnityDocument.load_yaml(project_settings_file)\nProjectSettings = doc.entry\nProjectSettings.scriptingDefineSymbols['1'] += ';CUSTOM_DEFINE'\nProjectSettings.scriptingDefineSymbols['7'] = ProjectSettings.scriptingDefineSymbols['1']\ndoc.dump_yaml()\n\n# You can also load YAML files with multiple documents\nhero_prefab_file = 'UnityProject/Assets/Prefabs/Hero.prefab'\ndoc = UnityDocument.load_yaml(hero_prefab_file)\nfor entry in doc.entries:\n if entry.__class__.__name__ == 'MonoBehaviour' and getattr(entry, 'MaxHealth', None) is not None:\n entry.MaxHealth = str(int(entry.MaxHealth) + 10)\n break\ndoc.dump_yaml()\n# calling entry method for a doc with multiple document will return the first one\nprint(doc.entry.__class__.__name__)\n# 'Prefab'\n````\n\n## Classes ##\n\n### unityparser.UnityDocument ###\n\nMain class to load and dump files.\n\n#### unityparser.UnityDocument.load_yaml(file_path) ####\n\n_**Classmethod**_: Load the given YAML file_path and return a UnityDocument file\n\n#### unityparser.UnityDocument.dump_yaml(file_path=None) ####\n\nDump the UnityDocument to the previously loaded file location(overwrite). \nIf *file_path* argument is provided, dump the document to the specified location instead.\n\nThis method **keeps line endings** of the original file when it dumps.\n\n#### unityparser.UnityDocument.entries ####\n\n_**Property**_: Return the _list_ of documents found in the YAML. The objects in the _list_ are of _types_ Class named after the serialized Unity class(ie. MonoBehaviour, GameObject, Prefab, CustomName, etc).\n\n#### unityparser.UnityDocument.entry ####\n\n_**Property**_: Return the first document in the YAML, useful if there is only one. Equivalent of doing `UnityDocument.entries[0]`.\n\n### unityparser.loader.UnityLoader ###\n\nPyYAML's Loader class, can be used directly with PyYAML to customise loading. \n\n### unityparser.dumper.UnityDumper ###\n\nPyYAML's Dumper class, can be used directly with PyYAML to customise dumping. \n\n## Considerations ##\n\n**unityparser** converts _every_ scalar value in the YAML to _string_ when loading the data for safety purposes. Any key from the mappings in the YAML included. \n\nYou have to make sure to convert every modified/added value(or _dict_ key) in the loaded data object back to _string_ before dumping the document. Otherwise the written YAML will contain ugly tags.\n\nText scalars which are single or double quoted that span multiple lines are not being dumped exactly as Unity does. There's a difference in the maximum length allowed per line and the logic to wrap them.\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/socialpoint-labs/unity-yaml-parser", "keywords": "unity,yaml,parser,serializer", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "unityparser", "package_url": "https://pypi.org/project/unityparser/", "platform": "", "project_url": "https://pypi.org/project/unityparser/", "project_urls": { "Homepage": "https://github.com/socialpoint-labs/unity-yaml-parser" }, "release_url": "https://pypi.org/project/unityparser/0.1.0/", "requires_dist": [ "PyYAML (==5.1)" ], "requires_python": ">=3.5.0", "summary": "A python library to parse and dump Unity YAML files", "version": "0.1.0" }, "last_serial": 5997890, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2720983e14e8acdc464b08fcf1163d1f", "sha256": "5db9a5e9ce7a11d9d5786edb32e92e8eb14a70daafc4b446aeda8794c2819b4e" }, "downloads": -1, "filename": "unityparser-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2720983e14e8acdc464b08fcf1163d1f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.0", "size": 14869, "upload_time": "2019-06-11T10:33:15", "url": "https://files.pythonhosted.org/packages/53/41/22188ac9e4d511d76f8ff9c54852fc360c913dcdd6732d76bb9f511ec072/unityparser-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4eaa930fc4c37818dd829750b61ccc7", "sha256": "c4781c1e083a787cc249b76d7eb7383ddbdc3adfc3f409a18444e9008023a312" }, "downloads": -1, "filename": "unityparser-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e4eaa930fc4c37818dd829750b61ccc7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 12806, "upload_time": "2019-06-11T10:33:17", "url": "https://files.pythonhosted.org/packages/96/9d/5bef1b80a18eb97a5045cd2cf545fc37ba8282ae33c33109ad89c27eba2a/unityparser-0.0.1.tar.gz" } ], "0.0.1.post1": [ { "comment_text": "", "digests": { "md5": "5017910bc3427006974f77f68c8daf8d", "sha256": "65ed777feb1d8056f561dd752926a106d2558633752de557fe4f919c236d0c90" }, "downloads": -1, "filename": "unityparser-0.0.1.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "5017910bc3427006974f77f68c8daf8d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.0", "size": 14959, "upload_time": "2019-06-11T10:41:20", "url": "https://files.pythonhosted.org/packages/af/ca/1e3036f3820f2ee3d6d2c1689431741e47f6357a3511b748cb3877865ff8/unityparser-0.0.1.post1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ca30e312becd45190ed8cac7eeb089e", "sha256": "e050e59ded57e70bbbe269a5ec2235df18c1ce098bf074238f11511b320cc3d7" }, "downloads": -1, "filename": "unityparser-0.0.1.post1.tar.gz", "has_sig": false, "md5_digest": "0ca30e312becd45190ed8cac7eeb089e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 12810, "upload_time": "2019-06-11T10:41:22", "url": "https://files.pythonhosted.org/packages/03/ba/f4f2e8ad1508139975493ad07052f9e562141ddf5cd1e65c2ffe728ccc6f/unityparser-0.0.1.post1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "d62457fd4f1b641c6d5d55f47ff0246a", "sha256": "20282b2b3cd5ac2871476c5729035b6c285ca29f8f4c6b70f1aed5aa216a12f1" }, "downloads": -1, "filename": "unityparser-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d62457fd4f1b641c6d5d55f47ff0246a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.0", "size": 16208, "upload_time": "2019-10-18T22:30:13", "url": "https://files.pythonhosted.org/packages/6f/fc/3dcd3d00b98ce0588ddf78d7a8b5d13faae39229cefc2c528ec2ad737111/unityparser-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f43415c7a24a66521210dbcf85dcbb6", "sha256": "58be8410fe05da21afda0a064885891679b5b8d3ef084291f57f2e61e8935ec5" }, "downloads": -1, "filename": "unityparser-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6f43415c7a24a66521210dbcf85dcbb6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 13626, "upload_time": "2019-10-18T22:30:16", "url": "https://files.pythonhosted.org/packages/d2/cb/48181742fbf07bee81b552231b81a00654d6af57d7c1a744b885d4231e1f/unityparser-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d62457fd4f1b641c6d5d55f47ff0246a", "sha256": "20282b2b3cd5ac2871476c5729035b6c285ca29f8f4c6b70f1aed5aa216a12f1" }, "downloads": -1, "filename": "unityparser-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d62457fd4f1b641c6d5d55f47ff0246a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5.0", "size": 16208, "upload_time": "2019-10-18T22:30:13", "url": "https://files.pythonhosted.org/packages/6f/fc/3dcd3d00b98ce0588ddf78d7a8b5d13faae39229cefc2c528ec2ad737111/unityparser-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6f43415c7a24a66521210dbcf85dcbb6", "sha256": "58be8410fe05da21afda0a064885891679b5b8d3ef084291f57f2e61e8935ec5" }, "downloads": -1, "filename": "unityparser-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6f43415c7a24a66521210dbcf85dcbb6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5.0", "size": 13626, "upload_time": "2019-10-18T22:30:16", "url": "https://files.pythonhosted.org/packages/d2/cb/48181742fbf07bee81b552231b81a00654d6af57d7c1a744b885d4231e1f/unityparser-0.1.0.tar.gz" } ] }