- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 636
 
fix(local_runtime): Improve local_runtime usability in macos / windows #3148
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 15 commits
      Commits
    
    
            Show all changes
          
          
            40 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      76926ac
              
                fix(local_runtime): Improve local_runtime usability in macos / windows
              
              
                laramiel b9cbc67
              
                Correct _expand_incompatible_template
              
              
                laramiel 965a6a9
              
                Update changelog
              
              
                laramiel 8b61915
              
                Formatting + minor cleanups
              
              
                laramiel 6ac66c9
              
                format WORKSPACE
              
              
                laramiel f4c0fed
              
                Move the complex logic to resolve the python shared libraries from bz…
              
              
                laramiel 9283a3f
              
                Fix formatting and method docs
              
              
                laramiel e8997c1
              
                Better handle missing interface_library values.  This can happen on m…
              
              
                laramiel 655ea0f
              
                Format local_runtime_repo_setup.bzl
              
              
                laramiel e4eea87
              
                reformat get_local_runtime_info.py and main.py
              
              
                laramiel 87d5391
              
                Update CHANGELOG and minor comments.
              
              
                laramiel 09bfee9
              
                Minor tweaks to library name genration
              
              
                laramiel dda37d6
              
                expand changelog description
              
              
                rickeylev d7b2888
              
                Merge branch 'main' into main
              
              
                rickeylev 0df9bf1
              
                name loop var, add non-uv libs finding comment
              
              
                rickeylev 5874d5c
              
                Distinguish between interface library and dynamic library file paths.
              
              
                laramiel 7bafc72
              
                Refine comments, a few other minor changes
              
              
                laramiel 7c3428e
              
                Update comment.
              
              
                laramiel 454c923
              
                Merge branch 'main' into main
              
              
                rickeylev 230f5cb
              
                Merge branch 'main' into main
              
              
                rickeylev 499ac15
              
                fix incorrect merge
              
              
                rickeylev 66a16f9
              
                Add workspace to tests/integration/local_toolchains
              
              
                rickeylev 9454daa
              
                Delete examples/local_python directory
              
              
                rickeylev a9f1e07
              
                Fallback to shared library if there is no static library
              
              
                laramiel 5757bcd
              
                add workspace test for local_toolchains
              
              
                rickeylev 931a1b6
              
                add mac, windows bazel-in-bazel jobs
              
              
                rickeylev db3de32
              
                buildifier WORKSPACE
              
              
                laramiel f6f31ff
              
                Add a test of building an extension for local_runtime
              
              
                laramiel 70509e1
              
                Complete extension rename: echo -> echo_ext
              
              
                laramiel 59c5812
              
                run pre-commit
              
              
                laramiel 379506f
              
                Minor improvements to py_extension test; add comments, rename, etc.
              
              
                laramiel d966723
              
                have mac/win only run local toolchains bazel in bazel integration test
              
              
                rickeylev 15d8e0d
              
                Add -fvisibility=hidden to py_extension
              
              
                laramiel 4dbf51d
              
                Simplify py_extension slightly
              
              
                laramiel 530ec06
              
                more minor updates to py_extension
              
              
                laramiel f32a551
              
                comment formatting
              
              
                laramiel 81f80e3
              
                replace if with else
              
              
                laramiel 79bbb75
              
                Cleanup logging slightly.
              
              
                laramiel edf83fb
              
                fix permission denied error on windows
              
              
                rickeylev 7e20b5c
              
                Merge branch 'main' into main
              
              
                rickeylev File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # The equivalent bzlmod behavior is covered by examples/bzlmod/py_proto_library | ||
| common --noenable_bzlmod | ||
| common --enable_workspace | ||
| common --incompatible_python_disallow_native_rules | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # git ignore patterns | ||
| 
     | 
||
| /bazel-* | ||
| user.bazelrc | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| load("@rules_python//python:py_binary.bzl", "py_binary") | ||
| 
     | 
||
| py_binary( | ||
| name = "main", | ||
| srcs = ["main.py"], | ||
| ) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| workspace( | ||
| name = "local_python_example", | ||
| ) | ||
| 
     | 
||
| local_repository( | ||
| name = "rules_python", | ||
| path = "../..", | ||
| ) | ||
| 
     | 
||
| load("@rules_python//python:repositories.bzl", "py_repositories") | ||
| 
     | 
||
| py_repositories() | ||
| 
     | 
||
| load("@rules_python//python/local_toolchains:repos.bzl", "local_runtime_repo", "local_runtime_toolchains_repo") | ||
| 
     | 
||
| # Step 1: Define the python runtime. | ||
| local_runtime_repo( | ||
| name = "local_python3", | ||
| interpreter_path = "python3", | ||
| on_failure = "fail", | ||
| # or interpreter_path = "C:\\path\\to\\python.exe" | ||
| ) | ||
| 
     | 
||
| # Step 2: Create toolchains for the runtimes | ||
| local_runtime_toolchains_repo( | ||
| name = "local_toolchains", | ||
| runtimes = ["local_python3"], | ||
| ) | ||
| 
     | 
||
| # Step 3: Register the toolchains | ||
| register_toolchains("@local_toolchains//:all") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2025 The Bazel Authors. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| 
     | 
||
| 
     | 
||
| def main(): | ||
| print(42) | ||
| 
     | 
||
| 
     | 
||
| if __name__ == "__main__": | ||
| main() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.