Skip to content

Logger.attach_suite is not exposed in Python bindings #215

@elliotmelcer

Description

@elliotmelcer

Summary

Logger::attach_suite exists in C++ and controls the "suite" field in the Analyzer's JSON output, but it's not exposed to Python. There's no way to set the suite name from Python when using wrap_problem, so JSONs always show "suite": "None".

Reproduction

import ioh
lg = ioh.logger.Analyzer(folder_name="demo")
lg.attach_suite("MySuite")
# AttributeError: 'ioh.iohcpp.logger.Analyzer' object has no attribute 'attach_suite'

Tested on ioh 0.3.22 (pip), Python 3.12, Windows 11.

Root cause

In ioh/src/logger.cpp, define_bases binds add_trigger, call, reset, and problem on Logger — but not attach_suite. The AbstractWatcher trampoline has an override hook for it, but the underlying method was never .def()-ed, so it can't be called from Python. The .pyi stub lists it on Logger, which is misleading.

Suggested fix

One line in define_bases:

.def("attach_suite", &Logger::attach_suite, py::arg("suite_name"),
     "Set the current suite name (written to the 'suite' field in Analyzer JSON output)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions