// pybind 11 related includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace py = pybind11;

// user-defined pre
{% if include_pre %}
#include "{{ include_pre }}"
{% endif %}

// forward declaration of the register_* functions

{% for mod in module_names %}
void register_{{mod}}_enums(py::module&);
{% endfor %}

{% for mod in module_names %}
void register_{{mod}}(py::module&);
{% endfor %}

// main module definiiton
PYBIND11_MODULE({{name}}, m) {

// register submodules

{% for mod in sorted_modules %}
    register_{{mod}}_enums(m);
{% endfor %}

{% for mod in sorted_modules %}
    register_{{mod}}(m);
{% endfor %}

// Add attributes if present

{% for k,v in settings['Attributes'].items() %}
    m.attr("{{k}}") = py::cast("{{v}}");
{% endfor %}

}
