BUCK
1 # src/examples/python/BUCK 2 # 3 # Python/C++ integration via nanobind 4 # 5 # Demonstrates: 6 # - C++ functions callable from Python 7 # - Class bindings with methods 8 # - Vector/STL container passing 9 # - String operations 10 # 11 # Build: buck2 build //src/examples/python:example 12 # Test: buck2 run //src/examples/python:test_example 13 14 load("@toolchains//:python.bzl", "nanobind_extension", "python_script") 15 16 # nanobind extension: C++ code callable from Python 17 nanobind_extension( 18 name = "example", 19 srcs = ["example.cpp"], 20 visibility = ["PUBLIC"], 21 ) 22 23 # Python test script that uses the extension 24 python_script( 25 name = "test_example", 26 main = "test_example.py", 27 deps = [":example"], 28 visibility = ["PUBLIC"], 29 )