Skip to content

fix(lib): Remove duplicate method binding (instance/static) from python lib for task#608

Merged
finger563 merged 2 commits intomainfrom
fix/task-python-binding
Feb 28, 2026
Merged

fix(lib): Remove duplicate method binding (instance/static) from python lib for task#608
finger563 merged 2 commits intomainfrom
fix/task-python-binding

Conversation

@finger563
Copy link
Contributor

Description

  • Ensure that the additional static variant esp::Task::get_id(...) is not included in the python bindings, as that will fail at runtime when trying to import.

Motivation and Context

Fixes an issue with the python bindings which would fail to import, despite being able to build.

How has this been tested?

  • Build the python bindings
  • Run the python task.py test script and ensure it works properly.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Copilot AI review requested due to automatic review settings February 28, 2026 20:52
@finger563 finger563 self-assigned this Feb 28, 2026
@github-actions
Copy link

✅Static analysis result - no issues found! ✅

@finger563 finger563 added bug Something isn't working lib library for use with other systems / languages python labels Feb 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a runtime import failure in the Python bindings (lib/python_bindings) caused by a name collision between an instance method and a static method both registered as get_id on the Task class. The fix removes the redundant def_static("get_id", ...) binding and also adds the previously missing Logger::get_verbosity binding.

Changes:

  • Removes the duplicate static Task::get_id(const Task&) binding from pybind_espp.cpp that collided with the instance get_id() and caused the module to fail on import.
  • Adds the missing Logger::get_verbosity binding (both in pybind_espp.cpp and __init__.pyi).
  • Updates __init__.pyi type stubs to reflect the above changes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/python_bindings/pybind_espp.cpp Removes duplicate def_static("get_id") for Task; adds get_verbosity binding for Logger
lib/python_bindings/espp/__init__.pyi Adds Logger.get_verbosity stub; removes Pid.set_config, Pid.clear, and Pid.update stubs (incorrectly)

One issue was identified:

The set_config, clear, and update methods were removed from the Pid class in __init__.pyi (lines 2159–2164 region), but these methods are still registered in pybind_espp.cpp at lines 1588–1598. This means the type stubs no longer reflect the actual runtime API for Pid: calling pid.set_config(...), pid.clear(), or pid.update(error) is valid at runtime but will produce type-checker/IDE errors. These method stubs need to be restored.

Additionally, the @staticmethod @overload def get_id(task: Task) stub in __init__.pyi for Task (lines 2998–3008, unchanged region) was not removed to match the removal of the corresponding binding in pybind_espp.cpp, leaving the stubs inconsistent with the actual bindings. This is outside the changed region of the diff, so no comment was filed, but it should be addressed alongside the fix.

@finger563 finger563 merged commit 5980ab4 into main Feb 28, 2026
8 of 9 checks passed
@finger563 finger563 deleted the fix/task-python-binding branch February 28, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lib library for use with other systems / languages python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants