{ "info": { "author": "Maik Wojcieszak", "author_email": "mw@wobew-systems.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# UJO Schemes\n\nUJO Schemes is an easy to read and easy to write language to define UJO data\nstructures. The definition is translated into a documentation and/or compiled into a binary form for fast an reliable checks on data sets.\n\n## Convert UJO Schemes to markdown documentation\n\nUJO Schemes files can be converted into a markdown documentation ```ujs2md.py```.\n\n__Usage:__\n\n```txt\nusage: ujs2md.py [-o ] \n\npositional arguments:\n source path to ujo scheme file or folder\n if providing a folder by default all files will be processed\n you might need to provide an extension by using the \"-ext/--extension\" option\n\noptional arguments:\n -h, --help show this help message and exit\n -o , --output \n output path for markdown\n -ext , --extension \n filter files by extension if providing a folder as \n example: \".ujs\"\n defaults to \".ujs\"\n```\n\n__Example:__\n\n```txt\npython .\\ujs2md.py -o testoutput -ext .ujs .\\examples\\ujs2md\n```\n\n## Module Name\n\nUIO Schemes can be divided into multiple modules. Each module is described in one file. At the \nbeginning of a file the module name is defined. Additionally a documentation section for the \nparticular module can be added.\n\n```python\nmodule myModule;\n```\n\nAdding documentation is done by using the doc keyword.\n\n```python\nmodule myModule\n : doc \"\"\"This text is a description\nof my module\"\"\";\n```\n\n## Types\n\n### Atomic Types\n\nAtomic types define the basic data fields in UJO. All data structures are build upon atomic types.\n\n| Keyword | Description |\n|---------------|---------------------------|\n| `int64` | 64 bit integer |\n| `int32` | 32 bit integer |\n| `int16` | 16 bit integer |\n| `int8` | 8 bit integer |\n| `uint64` | 64 bit unsigned integer |\n| `uint32` | 32 bit unsigned integer |\n| `uint16` | 16 bit unsigned integer |\n| `uint8` | 8 bit unsigned integer |\n| `float64` | double precision float |\n| `float32` | single precision float |\n| `float16` | half precision float |\n| `bool` | boolean (True/False) |\n| `date` | a date with Month:Day:Year|\n| `time` | time Hour:Minute:Second |\n| `datetime` | combination of time and date |\n| `timestamp` | combination of time and date and millisecond |\n| `string` | utf8 string |\n| `cstring` | a C string terminated by \\x00 |\n| `binary` | untyped binary object |\n\n### Container Types\n\nContainer types are used to organize values. A value in a container\ncan be a container. This nesting allows to define complex comprehensive\ndata structures.\n\n| Keyword | Description |\n|---------------|---------------------------|\n| `list` | A list of values |\n| `map` | A list of key/value pairs |\n\n### Variant Type\n\n| Keyword | Description |\n|---------------|---------------------------|\n| `variant` | All atomic and container types | |\n\nThe variant can hold values of any atomic and container type. The only constraint\npossible for variant type definitions is to exclude null as a possible value.\n\n## Defining Constraint Types\n\nBased on Atomic and Container Types new types can be defined by applying constraint\nrules on them.\n\nCreating a new type based on an existing atomic type without constraints. The new\ntype can contain the same values as the original type.\n\n```python\nnew_type = int64;\n```\n\nThe new type can be documented using `doc`.\n\n```python\nnew_type = int64 : doc \"This is my new type\"\n```\n\nMultiple lines can be used for better readability.\n\n```python\nnew_type = int64\n : doc \"This is my new type\";\n```\n\n## Constraint Rules\n\nConstraint Rules are used to define constraints on an atomic type.\n\n### Defining specific values\n\nStorypoints are an agile metric containing only specific numbers.\n\n```python\nStoryPoints = uint16\n : in (1, 2, 3 ,5, 8, 13, 20, 40, 100 );\n\nSciConst = float32\n : in (3.14, 9.81, 343,2);\n```\n\nThe `in` keyword can also be used to define specific words for a string.\n\n```python\nCardColor = string\n : in (\"Heart\", \"Spade\", \"Diamond\", \"Club\");\n```\n\n### Defining value ranges\n\nA range includes all values from a lowest value to highest value. If the lowest or highest value is omitted, the minimum or maximum possible value of the chosen atomic type is used. This rule can only be applied to numeric types.\n\n```python\n# all values from 0 to 10\nlowRange = uint32\n : in ( .. 10 );\n\n# all values from 10 to 4.294.967.295\nHiRange = uint32\n : in ( 10 .. );\n```\n\n### Documenting values\n\nValues and ranges can be documented using `doc`.\n\n```python\nCardColor = string\n : in (\n \"Heart\" : doc \"the red heart symbol\",\n \"Spade\" : doc \"this is black\",\n \"Diamond\" : doc \"a red symbol\",\n \"Club\" : doc \"looks like a little tree\");\n```\n\n### Make a value mandatory\n\nValues is UJO can be null by default. If null is not allowed in a dataset the `not null`\nrule is applied.\n\n```python\nnew_type = int64\n : not null\n : doc \"This is my new type with no null values allowed\";\n```\n\nIf a value is mandatory, a default value can be applied. \n\n```python\nnew_type = int64\n : not null default 5\n : doc \"This is my new type with no null values allowed, but with an automatic default value of 5\";\n```\n\n## List Type\n\nA list is a container type that can contain values of all valid ujo types by default.\n\n### A list for a specific type\n\nA list can created from any valid type including container types. Here is an example how \nto create a list of int64 values. Only int64 values and null can be stored.\n\n```python\nintList = list of int64;\n```\n\nIf I want to exclude null values from the list I can apply the relating type rule.\n\n```python\nintList = list of int64\n : not null;\n```\n\nA range can be applied as well.\n\n```python\nintList = list of int64\n : not null\n : in ( 100 .. 200 );\n```\n\nA constraint type can be defined first and used in the list definition.\n\n```python\n# a constraint type\nMyType = int64\n : in ( 100 ..200)\n : not null;\n\n# a list of this type\nintList = list of MyType;\n```\n\nThe `doc` rule can be applied to document the new list type.\nThe following example applies the `doc`rule with a text with line feeds.\n\n```python\n# a constraint type\nMyType = int64\n : in ( 100 ..200)\n : not null\n: doc \"a new list type\";\n\n# a list of this type\nintList = list of MyType\n: doc \"\"\"A list type\ndocumentation in multiple lines\"\"\";\n```\n\n### Defining a Record\n\nA record is a constraint on a list container. It defines a limited, fixed sequence of\nvalues with specific and fixed types.\n\n```python\nheader = list [\n timestamp,\n int64,\n int16,\n string,\n list\n];\n```\n\nFor reference and probably for later conversions into JSON or XML data a\nname can be applied to the data fields in the record.\n\n```python\nheader = list [\n timestamp : name CreationTime,\n int64 : name SequenceNumber,\n int16 : name Status,\n string : name Message,\n list : name Values\n];\n```\n\nConstraint rules can be applied on each value and the field can be documented.\n\n```python\nheader = list [\n timestamp\n : name CreationTime\n : doc \"Creation time of the message\",\n int64\n : name SequenceNumber\n : doc \"sequence number to order the messages\",\n int16\n : name Status\n : in (\n 0 : doc \"Ok\",\n 1 : doc \"Warning\",\n 2 : doc \"Error\",\n 3 : doc \"Critical\"\n )\n : not null\n : doc \"Processing status\",\n string\n : name Message\n : doc \"An error message\",\n list\n : name Values\n : doc \"a list with some values\"\n] : doc \"This is a record\";\n```\n\n### Extending a record\n\nAn already define record can be extended to contain more fields. The resulting\nrecords appends the new fields to the previously defined record part.\n\n```python\naMessage = list extends header [\n float32\n : name temperature\n : doc \"value read from a sensor\",\n boolean\n : name FanStatus\n : doc \"True = On, False = Off\"\n];\n```\n\n## Associative array (map)\n\nConstraints on Assoziative arrays apply to keys and values. All atomic\ntypes are allowed to be used as keys. Values can be any type including containers.\n\n### Define a static array with fixed keys\n\nDefine keys of a map with a type definition of each\nkey/value pair.\n\n```python\n = map { \n [ as ] | ,\n };\n```\n\nThe `as ` definition is a cast of the default literal type\nto a specific atomic type. The cast is optional.\n\nThe following example shows how to define a static map.\n\n```python\nmapType = map { 3.14 as float32 | list, \n \"temperature\" | cstring : doc \"another doc string\" }\n: doc \"map defintion\";\n```\n\n### Use a custom datatype as map key\n\nA custom datatype can be used as key for a map. All scalar types can be\nused.\n\n__Example:__\n\n```python\nnew_str = cstring\n : in (\n \"Test\",\n \"Fact\"\n );\n\nmapType = map { 3.14 as float32 | list, \n \"temperature\" | float32 \n : doc \"another doc AA:XX string\",\n \"items\" | list of int32\n : length(2 .. 6)\n : doc \"a list with a specific length\",\n new_str | int64\n : doc \"a data type as key\",\n float32 | int64\n : doc \"a data type as key\"\n }\n: doc \"map defintion\";\n```\n\n### Extending a static map\n\nA static map defintion can be extended using the `extend` keyword.\n\n```python\nextMapType = map extends mapType { \n 5 | list, \n \"test\" | cstring : doc \"another doc string\" }\n: doc \"map defintion\";\n```\n\n### Define typed maps\n\nThe type of keys and values in a map can be defined. The following\nexample demonstrates the definition of a map with int64 keys\nbut variant values of all types.\n\n```python\nkeyTypeMap = map of int64 | variant : doc \"my type defintion\";\n```\n\n## Defining variant types\n\nThe type `variant` is a wildcard for any types available, not matter if atomic, custom or container.\nSometimes a data definition requires the flexibility of a variant, but still needs to be limited\nto a subset of types.\n\n```python\nnumeric = variant of [ int64, int32, int16, float64, float32, float16 ]\n : doc \"a constraint variant type\";\n```\n\nA documentation for each type can be added.\n\n```python\nnumeric = variant of [ \n int64 : doc \"large int numbers\", \n int32 : doc \"save memory for smaller numbers\",\n int16 : doc \"save more memory for smalle numbers\",\n float64 : doc \"allow large float\",\n float32 : doc \"save mem for smaller float\",\n float16 : doc \"you might want to save even more memory\"]\n : doc \"a constraint variant type\";\n```\n\nOther constraints can be added likewise.\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://www.industrial-devops.org", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "UJOScheme", "package_url": "https://pypi.org/project/UJOScheme/", "platform": "", "project_url": "https://pypi.org/project/UJOScheme/", "project_urls": { "Homepage": "https://www.industrial-devops.org" }, "release_url": "https://pypi.org/project/UJOScheme/0.0.3/", "requires_dist": [ "lark-parser" ], "requires_python": "", "summary": "UJO Schemes is an easy to read and easy to write language to define UJO data structures.", "version": "0.0.3" }, "last_serial": 5381032, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "29da8b99d2bec1b4d60cab7e1850bfb8", "sha256": "733d4f3db7dde5ed8ff4cddb8eac97529156c5aa1ceaa8bddb852bacffacc519" }, "downloads": -1, "filename": "UJOScheme-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "29da8b99d2bec1b4d60cab7e1850bfb8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16746, "upload_time": "2019-06-10T13:33:29", "url": "https://files.pythonhosted.org/packages/ae/38/1081a3fbfac1c9e4d561df649cf82192feee042d15006d9b197dfd1fa487/UJOScheme-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd40a32cbc71e71eb6949fe719f34b49", "sha256": "2a48887fbdb3ef227cac3fd0238c82aa865a64649ceb70a14d1c67091b67956c" }, "downloads": -1, "filename": "UJOScheme-0.0.3.tar.gz", "has_sig": false, "md5_digest": "cd40a32cbc71e71eb6949fe719f34b49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16925, "upload_time": "2019-06-10T13:33:32", "url": "https://files.pythonhosted.org/packages/ec/3d/406e44b9671761704a70284b70cebf6fe609e6765c611fa97724022b067d/UJOScheme-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "29da8b99d2bec1b4d60cab7e1850bfb8", "sha256": "733d4f3db7dde5ed8ff4cddb8eac97529156c5aa1ceaa8bddb852bacffacc519" }, "downloads": -1, "filename": "UJOScheme-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "29da8b99d2bec1b4d60cab7e1850bfb8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16746, "upload_time": "2019-06-10T13:33:29", "url": "https://files.pythonhosted.org/packages/ae/38/1081a3fbfac1c9e4d561df649cf82192feee042d15006d9b197dfd1fa487/UJOScheme-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd40a32cbc71e71eb6949fe719f34b49", "sha256": "2a48887fbdb3ef227cac3fd0238c82aa865a64649ceb70a14d1c67091b67956c" }, "downloads": -1, "filename": "UJOScheme-0.0.3.tar.gz", "has_sig": false, "md5_digest": "cd40a32cbc71e71eb6949fe719f34b49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16925, "upload_time": "2019-06-10T13:33:32", "url": "https://files.pythonhosted.org/packages/ec/3d/406e44b9671761704a70284b70cebf6fe609e6765c611fa97724022b067d/UJOScheme-0.0.3.tar.gz" } ] }