Configuring AutoPyBind11¶
AutoPyBind11 has a number of configurable options, settings, and binding code blocks that can be set/changed by a user via configuration.
The user has two options for specifiying these settings, either via the CLI, or via a configuration file using Yaml syntax(recommended).
The :ref:`Useage`_ section lists the number of CL options provided by AutoPyBind11 to configure the tool’s function, and they range from toggling features to specifying code blocks to use for specific components of the binding code. This section will cover each option for configuring AutoPyBind11, it’s options, and the variying methods for specifiying each option.
When specifiying options via the CL, the options can be set as you would a typical CL option for a Python program, however, there are many options and a number of these options are long, multi-line strings neither of which allow for a clean, manageable CLI exeperience. The Yaml file approach is the recommended approach for specifying a number of these options.
The configuration yaml file itself is an optional CL option, and as mentioned in the useage section, options can be specified in both the config file and the CL, but CL options will
overwrite whatever is specified by the YAML. If an option is specified by the config file, it does not need to be included in the CLI and vice versa. If the CMake interface is chosen, then the
CLI cannot be used at all, and in order to configure AutoPyBind11, the CONFIG_INPUT argument to the autopybind11_add_module command must be provided the location of a config file.
Option list:
Options |
Useage and Meaning |
|---|---|
enforce_namespace_structure |
|
Useage : enforce_namespace_structure: true |
|
private_members_as_fields |
|
|
|
enable_doc_strings |
|
|
|
expand_declarations |
|
|
|
expand_stl_declarations |
|
|
|
apply_global_namespace |
|
|
|
assumed_qualifiers |
Default is an empty list. Add scoping qualifier to list to remove qualifier(including GNS) from the binding output. |
|
|
template_defaults |
Default is an empty list Each entry in list specifies a templated type with default parameters and for each template parameter a value of 1 or 0 indicating whether or not that param will be included in the binding output. References to params are done in order and all parameters must be specified. |
|
|
use_cxx_14 |
Toggle cxx14 compiler dependent
features such as |
|
|
pass_eigen_by_ref |
Eigen types are passed to/from C++ via potentially expensive copy operations. PyBind11 supports Eigen::Ref semantics to facilitate passing Eigen types by thin reference. Default is True |
|
|
use_eigen_return_policy |
PyBind11 has the concept of return policies that dictate how objects return to Python are handled. Eigen types returned by l-value ref are copied. Enabling this option ensures return values are referenced instead. Default: True |
|
|
compiler_opts |
AutoPyBind11 uses LLVM-Clang via CastXML to compile C++ files before generating the binding code. Specify arguments to pass to the compiler. Default: None |
|
|
print_python_warnings |
AutoPyBind11 uses Pygccxml under the hood. This option supresses warnings raised by pygccxml. Default: True |
|
|
no_format |
AutoPyBind11 leverages clang-format to format the output files containing the binding code. This option disables or enables the use of clang-format. Default: False |
|