◐ Shell
clean mode source ↗

cffi: adapt bindings for libyang 5.x API changes by pepa-cz · Pull Request #170 · CESNET/libyang-python

libyang 5.x introduced several breaking changes compared to 4.x:

- Bump minimum required soversion to 5.3.0.
- Add ly_yang_module_dir() and ly_ctx_set_options() to cdefs.h.
- In Context.__init__, always add ly_yang_module_dir() to the search path
  so that internal modules (no longer embedded in 5.x) are found at context
  creation time. When disable_searchdirs=True, apply LY_CTX_DISABLE_SEARCHDIRS
  via ly_ctx_set_options() after context creation rather than passing it to
  ly_ctx_new(), which would prevent loading of internal modules.
- ly_log_options(): int -> uint32_t.
- lyd_node.parent and related fields: lyd_node_inner * -> lyd_node *.
- Remove LYD_NEW_VAL_BIN and LYS_GETNEXT_WITHSCHEMAMOUNT (removed in 5.x).
- lys_find_child(): extended signature with ly_ctx and name filter params.
- lyd_node_any: replace lyd_any_value union and LYD_ANYDATA_VALUETYPE
  with child/children_ht/value/hints fields matching the new struct layout.
- lyd_any_value_str(): add LYD_FORMAT parameter and pass data_format(fmt)
  from the Python callers.
- lyd_dup_siblings/single(): lyd_node_inner * -> lyd_node *.
- Update tests for libyang 5.x behavioral changes: module import callbacks
  are also called for transitive imports, and error data paths may omit
  intermediate containers.

Signed-off-by: Pepa Hajek <hajekpepa@gmail.com>

@pepa-cz closed this

Apr 29, 2026

@pepa-cz pepa-cz deleted the cffi-libyang5-api-update branch

April 29, 2026 10:56

@pepa-cz pepa-cz restored the cffi-libyang5-api-update branch

April 29, 2026 12:31