Changelog
Version 0.9.0
clair/c2py 0.9.0 is a major release that matures clair into a standalone Clang tool for automatic C++ → Python bindings generation, the result of a long development effort since the initial 0.1 series. The headline changes are:
Standalone Clang tool:
clair-c2pyis now a standalone Clang LibTooling tool rather than a compiler plugin, which simplifies deployment and CMake integration.TOML configuration: each module is configured through an optional
<module>.tomlfile (package_name,documentation,namespaces,match_names,reject_names,match_files,wrap_no_arg_methods_as_properties,exclude_system_headers); use--gen-default-config/--update-configto create and refresh it.Automatic documentation: C++ Doxygen /
///comments are transcribed into NumPy-style Python docstrings, including dispatch documentation for overloaded functions.Wider C++ coverage: class and method renaming, properties, reference return values, a broad set of operators, enums (including nested and cross-module), and function / class templates with parameter packs.
Cross-module bindings: namespace support, generated
<module>.wrap.hxxcompanion headers, andc2py_moduledeclarations spread across header files.Diagnostics & logging:
CLAIR_VERBOSElogging with a per-module log file,CLAIR_SKIP_CLANG_FORMAT, and converter-header suggestions in convertibility errors.The minimum required LLVM/Clang version is now 20 (tested through LLVM 22).
Fixes several issues.
We thank all contributors: Thomas Hahn, Olivier Parcollet, Nils Wentzell
Find below an itemized list of changes in this release.
General
clair-c2pyis now a standalone Clang tool instead of a compiler plugin.Add a per-module TOML configuration with validation, plus the
--gen-default-configand--update-configoptions to create and refresh it.Add the
exclude_system_headersconfiguration option.Add
--generate-depfileto emit a CMake-style depfile of the headers the generated bindings depend on.Add
CLAIR_VERBOSElogging with a per-module log file, andCLAIR_SKIP_CLANG_FORMATto skip the clang-format pass.Suggest the relevant converter headers in convertibility error messages.
Support class and method renaming (#11).
Support properties through
C2PY_PROPERTY_GET/C2PY_PROPERTY_SETand wrapping no-argument methods as properties.Support returning references, including references to members (of members) at any depth (#14).
Wrap enums, including nested enums under namespace filtering (#17) and cross-module enum use.
Wrap function and class templates through explicit instantiations in the
c2py_modulenamespace, including template parameter packs (#19) and template members with default arguments (#22).Allow
c2py_moduledeclarations in included files.Allow friend functions to be wrapped (#21).
Allow
PyObject*as a function return type.Improve handling of default arguments, including unqualified (#15) and unresolved types.
Improve the
--versionoutput and document all options in the usage text.Bump the minimum required LLVM/Clang version to 20 and add compatibility through LLVM 22.
Make clair fetchable from GitHub for dependent repositories (#25).
operators
Wrap operators: function call, subscript (
operator[]),operator<<, unary minus, left shift, and in-place operators (#20).Add a return-type check for
operator<<inanalyze_operator.
codegen
Add
C2PY_DEPRECATED_PARAMETER_NAMEannotation support.
c2py
Skip generating the
.wrap.hxxfile when there is no wrap information to emit.
clu
Cache the result of concept evaluation.
doc
Transcribe C++ comments into NumPy-style Python docstrings for functions and classes, preserving parameter order and handling multiple overloads.
Restructure and expand the documentation (getting started, CMake integration, code annotations, TOML options, function/class template examples).
cmake
Overhaul the CMake files and project structure.
Use
GNUInstallDirsmore consistently (#3).On macOS, link against the libc++ provided by the LLVM installation.
Add a
Findsanitizermodule.