File tree Expand file tree Collapse file tree 4 files changed +59
-0
lines changed Expand file tree Collapse file tree 4 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ # Enable logging rc options.
2+ common --announce_rc
3+ 
4+ ###############################################################################
5+ # Options for continuous integration.
6+ ###############################################################################
7+ 
8+ # All build options also apply to test as described by the "Option precedence"
9+ # section in https://bazel.build/run/bazelrc#bazelrc-syntax-semantics.
10+ 
11+ # Note for anybody considering using --compilation_mode=opt in CI, it builds
12+ # most files twice, one PIC version for shared libraries in tests, and one
13+ # non-PIC version for binaries.
14+ build:ci --copt=-O1
15+ 
16+ # Show as many errors as possible.
17+ build:ci --keep_going
18+ 
19+ # Show test errors.
20+ test:ci --test_output=all
21+ 
22+ # Only show failing tests to reduce output
23+ #test:ci --test_summary=terse
24+ 
25+ ###############################################################################
26+ # Put user-specific options in user.bazelrc
27+ # See https://bazel.build/configure/best-practices#bazelrc-file
28+ ################################################################################
29+ try-import %workspace%/user.bazelrc
Original file line number Diff line number Diff line change 1+ load ("@pybind11_bazel//:build_defs.bzl" , "pybind_library" , "pybind_library_test" )
2+ 
3+ pybind_library (
4+     name  =  "embed" ,
5+     srcs  =  ["embed.cc" ],
6+ )
7+ 
8+ pybind_library_test (
9+     name  =  "embed_test" ,
10+     size =  "small" ,
11+     deps  =  [":embed" ],
12+ )
Original file line number Diff line number Diff line change 1+ bazel_dep (name  =  "platforms" , version  =  "1.0.0" )
2+ bazel_dep (name  =  "rules_python" , version  =  "1.5.1" )
3+ bazel_dep (name  =  "pybind11_bazel" )
4+ local_path_override (
5+     module_name  =  "pybind11_bazel" ,
6+     path  =  "../.." ,
7+ )
Original file line number Diff line number Diff line change 1+ #include  < pybind11/embed.h> 
2+ namespace  py  =  pybind11;
3+ using  namespace  py ::literals; 
4+ 
5+ int  main () {
6+     py::scoped_interpreter guard{};
7+ 
8+     auto  kwargs = py::dict (" name"  _a=" World"  , " number"  _a=42 );
9+     auto  message = " Hello, {name}! The answer is {number}"  _s.format (**kwargs);
10+     py::print (message);
11+ }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments