Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple usage example for python #1202

Closed
fralik opened this issue Apr 19, 2024 · 1 comment
Closed

Simple usage example for python #1202

fralik opened this issue Apr 19, 2024 · 1 comment
Labels

Comments

@fralik
Copy link

fralik commented Apr 19, 2024

Hi!
Could you provide a simple isolated usage example for Python? I am reading the documentation page and looking inside examples folders, but it doesn't help me much. The documentation simply doesn't tell how to build the code, it jumps from C++ code that exposes structures to python code.

The provided example of CMakeLists.txt (https://github.com/microsoft/bond/blob/b13fee1b760119a79d038e43fb05d88e800fc7e5/cmake/Folders.cmake) is not self-contained. If I copy it to my drive and try to run, it will fail:

Unknown CMake command "add_bond_python_module"

I am using Bond via vcpkg, currently on Windows, but would run it on Linux as well.

@chwarr
Copy link
Member

chwarr commented May 14, 2024

Bond's Python bindings are implemented using the Boost.Python library, so you will have to build the C++ version of Bond, and then write a bit of glue C++ code to expose your Bond C++ types to Python.

The Bond C++ documentation has general guidance for how to integrate Bond into your build. I don't have any experience with vcpkg + Boost.Python, so I can't help you there.

You're right that the Python example isn't standalone. This isn't something that we plan to address at any time in the future. Sorry that there isn't more guidance. If you get something working and you think it would be useful to include in the Bond Python docs, please feel free to open a pull request.

@chwarr chwarr closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants