{ "info": { "author": "Flatdata Developers", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# flatdata-generator\n\n[![Build Status](https://api.travis-ci.com/heremaps/flatdata.svg?branch=master)](https://travis-ci.com/heremaps/flatdata/)\n\nGenerates code from a [flatdata](https://github.com/heremaps/flatdata) schema file.\n\nFor more information on `flatdata` and its implementations, please [refer to flatdata's homepage](https://github.com/heremaps/flatdata).\n\n## Using `flatdata-generator`\n\n```sh\n# installation\npip3 install flatdata-generator\n\n# example: generate a header-only C++ library\nflatdata-generator -s locations.flatdata -g cpp -O locations.hpp\n```\n\nCurrently supported target languages:\n\n* C++\n* Rust\n* Python\n* Go\n* Dot (graph of the schema)\n* Flatdata (normalized stable schema)\n\n## Architecture\n\n### Stages\n\nThe `flatdata` generator works in several stages which are clearly separated from one another and can be extended/tested in isolation:\n\n1. **Parse the source schema** file using `pyparsing` library. Grammar\n for the schema is defined in `grammar.py`\n2. **Construct a node tree** out of `pyparsing.ParseResults`. The node tree\n contains entities for every construct of flatdata grammar, organized\n in hierarchical order, allowing non-tree references between nodes:\n\n - `Namespace` - Nesting namespaces in the tree is allowed.\n - `Structure` - Structures are grouping together a set of fields.\n - `Archive` - Archives are grouping together resources and are\n referencing structures or other archives (see `Reference`)\n - `ResourceBase` - All resources derive from `ResourceBase`\n - `Reference` - All references between flatdata entities are\n modeled with `Reference` nodes. All references participate in\n name resolution. There are two type of references:\n - `RuntimeReference` - model explicit references and bound\n resources that show themselves at runtime.\n - `TypeReference` - model type dependencies, which are used during\n topological sorting at a later stage and for schema resolution.\n\n3. **Augment the tree** with structures and references that are not\n directly corresponding to `pyparsing.ParseResults` or needed to\n implement advanced features. Among these:\n\n - **Add builtin structures** if any of the resources require them. For\n example, `multivector< N, ... >` requires\n `_builtin.multivector.IndexTypeN` to be available.\n - **Add constant references** to all archives so that constants are\n available for schema resolution.\n\n4. **Resolve references** iterates through all references and tries to\n find a node they refer to, either in:\n\n - Parent scopes until (inclusive) innermost parent namespace.\n - Root node if path is fully qualified.\n\n5. **Perform topological sorting** to detect cycles in between entities\n and to determine the order of serialization for targets that depend\n on one.\n\n6. **Generate the source code** using nodes in topological order *and/or*\n the tree (depending on the generator architecture - recursive descent\n or iterative).\n\n### Node Tree\n\nEvery node of the tree consists of its name, properties (metadata) and\nholds references to its children. Every node is reachable via certain\npath which is a dot-joint concatenation of the names of its parents.\nNode tree enforces several properties of the flatdata schema:\n\n- *No conflicting declarations*: No two nodes with the same path are\n allowed.\n- *All references are correct*: All reference nodes are resolvable.\n- *No cyclic dependencies among resources*: All `TypeReference`\n participate in topological sorting of the DAG formed by the tree\n edges and edges between source and target of a `TypeReference`\n\n### References\n\nReference names are mangled so they are not ambiguous with other paths\ncomponents. For example reference to type `T` would have name `@T`,\nand similarly reference to `.foo.bar.T` would change to\n`@@foo@bar@T`.", "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/heremaps/flatdata", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "flatdata-generator", "package_url": "https://pypi.org/project/flatdata-generator/", "platform": "", "project_url": "https://pypi.org/project/flatdata-generator/", "project_urls": { "Homepage": "https://github.com/heremaps/flatdata" }, "release_url": "https://pypi.org/project/flatdata-generator/0.3.0.post2/", "requires_dist": null, "requires_python": "", "summary": "Generate source code for C++, Rust, Go or Python from a Flatdata schema file", "version": "0.3.0.post2" }, "last_serial": 5682037, "releases": { "0.2.4": [ { "comment_text": "", "digests": { "md5": "53c438e38cbdb6c42d2df074f5c31224", "sha256": "df03ec7b5f8b417abf81d5a3a78f337a38c14e9f655ae6507ab395ca03fff1da" }, "downloads": -1, "filename": "flatdata_generator-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "53c438e38cbdb6c42d2df074f5c31224", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 61544, "upload_time": "2019-04-10T21:18:36", "url": "https://files.pythonhosted.org/packages/e9/d4/9fa0b207605a2fdc5f284ae29ac4efb591b6727aaf15257e7963c87026fa/flatdata_generator-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2e440b4a98affc291c67bfa3165e92d5", "sha256": "9f03f4f51028ecc0325dd955c6971f0e38bfb30d75174164834a6440db8ef909" }, "downloads": -1, "filename": "flatdata-generator-0.2.4.tar.gz", "has_sig": false, "md5_digest": "2e440b4a98affc291c67bfa3165e92d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34103, "upload_time": "2019-04-10T21:18:38", "url": "https://files.pythonhosted.org/packages/52/1d/58bcde0e02a1e5c32b14949e02d844e99de55822362c989eea95b0f80b36/flatdata-generator-0.2.4.tar.gz" } ], "0.3.0.post2": [ { "comment_text": "", "digests": { "md5": "2728924d29be74480325419120289e20", "sha256": "b10f45b7a5b7d0bbe34a05b4ba27d6356f37413e883500e7d22a94b1bdc14e7d" }, "downloads": -1, "filename": "flatdata-generator-0.3.0.post2.tar.gz", "has_sig": false, "md5_digest": "2728924d29be74480325419120289e20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34603, "upload_time": "2019-08-15T12:38:30", "url": "https://files.pythonhosted.org/packages/97/d6/d4c1201557f6b5b19774709dea12c2d74c117ec8d11a4dc6de51006f4f90/flatdata-generator-0.3.0.post2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2728924d29be74480325419120289e20", "sha256": "b10f45b7a5b7d0bbe34a05b4ba27d6356f37413e883500e7d22a94b1bdc14e7d" }, "downloads": -1, "filename": "flatdata-generator-0.3.0.post2.tar.gz", "has_sig": false, "md5_digest": "2728924d29be74480325419120289e20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34603, "upload_time": "2019-08-15T12:38:30", "url": "https://files.pythonhosted.org/packages/97/d6/d4c1201557f6b5b19774709dea12c2d74c117ec8d11a4dc6de51006f4f90/flatdata-generator-0.3.0.post2.tar.gz" } ] }