Skip to content

Comments

Add Python type stub (.pyi) generation for tesseract_decoder#189

Open
dandragona-dev wants to merge 1 commit intoquantumlib:mainfrom
dandragona-dev:add-pyi-stubs
Open

Add Python type stub (.pyi) generation for tesseract_decoder#189
dandragona-dev wants to merge 1 commit intoquantumlib:mainfrom
dandragona-dev:add-pyi-stubs

Conversation

@dandragona-dev
Copy link
Contributor

@dandragona-dev dandragona-dev commented Feb 20, 2026

Addresses #154.

  1. Creates python stub file generation script using pybind11-stubgen. This script stores the files under src/tesseract_decoder-stubs. Each .pyi file is auto-generated without any modifications.

  2. Integrates this into CMake and GitHub Workflows. Note that I was not able to successfully cmake this project (even at head without any changes), so consider my changes to CmakeLists.txt as untested (should I just drop them?).

  3. Adds tests to ensure stubfiles exist and are valid python (maybe we can drop the valid python check + symbol expectation, WDYT?). Note that I think there is an issue with the visualizer stubs since

Smaller changes:
a. Adds pybind11-stubgen to the requirements file.
b. Creates src/tesseract_decoder-stubs/ directory to house the .pyi files.
c. Adds comments to the pybind files telling devs to regenerate the stubfiles upon making pybind changes.

Verification:
Unit tests, and just seeing if autocomplete works now:
Autocomplete without stubfiles:
Screenshot 2026-02-20 at 9 12 48 AM

Autocomplete with stubfiles:
Screenshot 2026-02-20 at 9 09 29 AM

@dandragona-dev dandragona-dev requested a review from a team as a code owner February 20, 2026 19:16
@dandragona-dev dandragona-dev requested review from noajshu and removed request for a team February 20, 2026 19:16
@google-cla
Copy link

google-cla bot commented Feb 20, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant