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