Skip to content

Commit ab44a0f

Browse files
committed
Document configurable name transforms
1 parent 8c989c7 commit ab44a0f

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

docs/config/autowrap.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,34 @@ generated by semiwrap. In your ``meson.build`` after you include the generated
6161
)
6262
6363
64+
Name transforms
65+
---------------
66+
67+
Generated Python names for functions, methods, and attributes can be configured
68+
with ``name_transform``. Explicit ``rename`` entries still take precedence, and
69+
YAML ``strip_prefixes`` is applied before the transform.
70+
71+
Configuration precedence is:
72+
73+
#. YAML ``name_transform``
74+
#. ``[tool.semiwrap.extension_modules."pkg.name"].name_transform``
75+
#. ``[tool.semiwrap].name_transform``
76+
#. ``default``
77+
78+
Built-ins are ``default``, ``camelCase``, ``snake_case``, and ``PascalCase``.
79+
Custom transforms use ``custom: package.name:function`` and receive
80+
``(name: str, kind: str)`` where kind is ``function``, ``method``, or
81+
``attribute``.
82+
83+
Example::
84+
85+
name_transform: snake_case
86+
strip_prefixes:
87+
- SW_
88+
89+
Name transforms do not apply to classes, enums, enum values, template instance
90+
names, or parameter names.
91+
6492
Reference
6593
---------
6694

0 commit comments

Comments
 (0)