Skip to main content

Generate code from DSDL using Jinja2 templates.

Project description

tox build (master) Build status
static analysis Sonarcloud Quality Gate Sonarcloud bugs
unit test code coverage Sonarcloud coverage
Python versions supported Supported Python Versions
latest released version PyPI Release Version
documentation Documentation Status
license MIT license
community/support UAVCAN forum

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 }}_{{ | 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.


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).


The documentation for Nunavut is hosted on

Nunavut is part of the UAVCAN project:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nunavut, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size nunavut-0.3.0-28-py3-none-any.whl (194.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nunavut-0.3.0-29-py3-none-any.whl (194.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size nunavut-0.3.0.tar.gz (165.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page