Skip to content

Add bazel statements needed for pybind11 and export common.h#23

Merged
LalehB merged 5 commits into
quantumlib:mainfrom
NoureldinYosri:main
May 19, 2025
Merged

Add bazel statements needed for pybind11 and export common.h#23
LalehB merged 5 commits into
quantumlib:mainfrom
NoureldinYosri:main

Conversation

@NoureldinYosri

@NoureldinYosri NoureldinYosri commented May 17, 2025

Copy link
Copy Markdown
Contributor

This PR:

  • modifies WORKSPACE to include the statements needed for pybind11
  • creates the pybind_extension and py_library that will wrap tesseract
  • exports the classes in common.h

this is the first of a series of PRs for #17


To check this code you can create a python file tmp.py

from src import tesseract_py
s = tesseract_py.common.Symptom([1, 2], 4324)
print(s)

and add a build rule

load("@rules_python//python:py_binary.bzl", "py_binary")

py_binary(
    name = "tmp",
    srcs = ["tmp.py"],
    deps = [
        ":tesseract_py",
    ],
)
$ bazel run src:tmp
Symptom{D1 D2 }

@NoureldinYosri NoureldinYosri marked this pull request as ready for review May 17, 2025 07:24

@noajshu noajshu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, could I suggest the alternate name tesseract_decoder?

Comment thread src/BUILD Outdated


pybind_extension(
name = "tesseract_py",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
name = "tesseract_py",
name = "tesseract_decoder",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done ... I also changed the names of the pybind11 files to match the convention used by stem

@NoureldinYosri

Copy link
Copy Markdown
Contributor Author

@noajshu I don't have permission to merge

@LalehB LalehB merged commit becf5a3 into quantumlib:main May 19, 2025
3 checks passed
@LalehB

LalehB commented May 19, 2025

Copy link
Copy Markdown
Collaborator

@noajshu I don't have permission to merge

Oh thanks for mentioning this @NoureldinYosri ! It should be fixed now, please let me know if you had any other issues!

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.

3 participants