Generate code from DSDL using Jinja2 templates.
Project description
tox build (master) |
|
static analysis |
|
unit test code coverage |
|
Python versions supported |
|
latest released version |
|
documentation |
|
license |
|
community/support |
Nunavut is a UAVCAN DSDL template engine that exposes a pydsdl abstract syntax tree to Jinja2 templates allowing authors to generate code, schemas, metadata, documentation, etc.
Partial example: generating a C struct
/*
* UAVCAN data structure definition
*
* Auto-generated, do not edit.
*
* Source file: {{T.source_file_path}}
*/
#ifndef {{T.full_name | c.macrofy}}
#define {{T.full_name | c.macrofy}}
{%- for constant in T.constants %}
#define {{ T | c.macrofy }}_{{ constant.name | c.macrofy }} {{ constant | constant_value }}
{%- endfor %}
typedef struct
{
/*
Note that we're not handling union types properly in this simplified example.
Unions take a bit more logic to generate correctly.
*/
{%- for field in T.fields %}
{%- if field is not padding %}
{{ field.data_type | declaration }} {{ field | id }}
{%- if field.data_type is ArrayType -%}
[{{ field.data_type.capacity }}]
{%- endif -%};
{%- if field is VariableLengthArrayType %}
{{ typename_unsigned_length }} {{ field | id }}_length;
{%- endif -%}
{%- endif -%}
{%- endfor %}
...
} {{ composite_type | full_reference_name }};
#endif // {{T.full_name | c.macrofy}}
Nunavut is named after the Canadian territory. We chose the name because it is a beautiful word to say and read. Also, the name fits with a theme of “places in Canada” started with the Yukon project.
Installation
Nunavut requires Python 3.5 or newer and depends on pydsdl.
Install from PIP:
pip install nunavut
Bundled third-party software
Nunavut embeds the following third-party software libraries into its source (i.e. these are not dependencies and do not need to be installed):
Jinja2 by Armin Ronacher and contributors, BSD 3-clause license.
markupsafe by Armin Ronacher and contributors, BSD 3-clause license (needed for Jinja).
Documentation
The documentation for Nunavut is hosted on readthedocs.io:
nunavut - The python library provided by this project.
nnvg – Command-line script for using nunavut directly or as part of a build system.
nunavut template guide – Documentation for authors of nunavut templates.
nunavut contributors guide – Documentation for contributors to the Nunavut project.
nunavut licenses – Licenses and copyrights
Nunavut is part of the UAVCAN project:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for nunavut-0.3.0-29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26fb8eaa093a9d7330bd475af1a84ed9c84b64b37ebba9672d5797cbd0b3e4af |
|
MD5 | ac2cbea7b8aa8147b12f3f77af3e18c2 |
|
BLAKE2b-256 | 58b618b3abf50e01624c1f91179908a3ca3aad26c73fcc82f1eeadfe2e670440 |
Hashes for nunavut-0.3.0-28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33b446a164e4fd14e0c85312acf8bc66d247c8f4c96b680c792061ec4aeaa5cf |
|
MD5 | 6152a7e7028728fcafaf6b5c04965364 |
|
BLAKE2b-256 | b40bd6a801dd8c52f7ee8f1f49cb3c43092d1200e2258c669b05c9c967f5abe1 |