@@ -61,11 +61,73 @@ 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, attributes/properties, and enum
68+ values can be configured with ``name_transform ``. Explicit ``rename `` entries are
69+ final and are not transformed.
70+
71+ Precedence is:
72+
73+ #. YAML ``name_transform ``
74+ #. ``[tool.semiwrap.extension_modules."pkg.name"].name_transform ``
75+ #. ``[tool.semiwrap].name_transform ``
76+ #. built-in ``default `` behavior
77+
78+ ``name_transform `` may be a string or a mapping. String form applies to all
79+ transformable kinds, including enum values:
80+
81+ .. code-block :: yaml
82+
83+ name_transform : snake_case
84+
85+ Mapping form can configure each kind separately:
86+
87+ .. code-block :: yaml
88+
89+ name_transform :
90+ default : snake_case
91+ method : camelCase
92+ attribute : none
93+ enum_value : PascalCase
94+
95+ Mapping keys are ``default ``, ``function ``, ``method ``, ``attribute ``, and
96+ ``enum_value ``. Missing kind-specific keys use ``default ``. Mapping values merge
97+ across precedence levels, so a YAML file can override only one kind while
98+ preserving project-level settings. A string value applies to every kind at that
99+ precedence level.
100+
101+ Built-ins are:
102+
103+ * ``none ``: passes the C++ name directly through without changing case.
104+ * ``default ``: function and method names lowercase the first character unless
105+ the first two characters are uppercase, while attribute and enum value names
106+ are unchanged.
107+ * ``camelCase ``: converts names to lower camel case, such as ``GetFoo `` or
108+ ``get_foo `` becoming ``getFoo ``.
109+ * ``snake_case ``: converts names to lowercase words separated by underscores,
110+ such as ``GetFoo `` or ``getFoo `` becoming ``get_foo ``.
111+ * ``PascalCase ``: converts names to upper camel case, such as ``getFoo `` or
112+ ``get_foo `` becoming ``GetFoo ``.
113+ * ``CAPS_CASE ``: converts names to uppercase words separated by underscores,
114+ such as ``GetFoo `` or ``getFoo `` becoming ``GET_FOO ``.
115+
116+ Custom transforms use ``custom: package.name:function `` and receive
117+ ``(name: str, kind: str) `` where kind is ``function ``, ``method ``,
118+ ``attribute ``, or ``enum_value ``.
119+
120+ Enum value transforms run after semiwrap's existing enum value prefix stripping.
121+ ``rename `` on an enum value remains exact and is not transformed.
122+
64123Reference
65124---------
66125
67- The following strctures describe the dictionaries that are read from the YAML
126+ The following structures describe the dictionaries that are read from the YAML
68127files. The toplevel structure is :class: `.AutowrapConfigYaml `.
69128
129+ .. autoclass :: semiwrap.name_transform.NameTransformConfig
130+ :members:
131+
70132.. automodule :: semiwrap.config.autowrap_yml
71133 :members:
0 commit comments