Skip to content
Generate Code from DSDL using pydsdl and jinja2
Branch: master
Clone or download
Pull request Compare This branch is even with UAVCAN:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
.gitmodules
.travis.yml
LICENSE.rst
README.rst
embed_jinja.py
requirements.txt
setup.cfg
setup.py
subtree.json
tox.ini

README.rst

PyDSDLgen

Note

PyDSDLgen is in version 1 since its basic architecture is fairly simple and unlikely to change much in the near term, however, PyDSDLgen cannot be more mature than PyDSDL. As such this package should be considered an Alpha release until it also relies on a PyDSDL version 1.

UAVCAN forum Documentation Status Codacy reports Codacy coverage Build status Pypi release

PyDSDLgen is a UAVCAN DSDL code generator that automates exposing 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
    *
    * Autogenerated, do not edit.
    *
    * Source file: {{T.source_file_path}}
    */

    #ifndef {{T.full_name | c.macrofy}}
    #define {{T.full_name | c.macrofy}}

    typedef struct {{T.full_name | c.to_snake_case}}Type
    {
{%- for attribute in T.attributes %}
{%- if attribute is constant %}
        const {{ attribute.data_type | c.type_from_primitive(use_standard_types=True) }} {{ attribute.name }} = {{ attribute.value }};
{% endif -%}
{% endfor %}

...

    } {{ T.full_name | c.to_snake_case }};

    #endif // {{T.full_name | c.macrofy}}

Installation

PyDSDLgen requires Python 3.5 or newer and depends on pydsdl.

Install from PIP:

pip install pydsdlgen

Bundled third-party software

PyDSDLgen 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 PyDSDLgen is hosted on readthedocs.io:

PyDSDLgen is part of the UAVCAN project:

You can’t perform that action at this time.