Class PythonRewriteRpc.Builder

java.lang.Object
org.openrewrite.python.rpc.PythonRewriteRpc.Builder
All Implemented Interfaces:
Supplier<PythonRewriteRpc>
Enclosing class:
PythonRewriteRpc

public static class PythonRewriteRpc.Builder extends Object implements Supplier<PythonRewriteRpc>
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • marketplace

      public PythonRewriteRpc.Builder marketplace(org.openrewrite.marketplace.RecipeMarketplace marketplace)
    • resolvers

      public PythonRewriteRpc.Builder resolvers(List<org.openrewrite.marketplace.RecipeBundleResolver> resolvers)
    • pythonPath

      public PythonRewriteRpc.Builder pythonPath(Path pythonPath)
      Path to the Python executable.
      Parameters:
      pythonPath - The path to the Python executable (e.g., "python3", "/usr/bin/python3")
      Returns:
      This builder
    • timeout

      public PythonRewriteRpc.Builder timeout(Duration timeout)
    • log

      public PythonRewriteRpc.Builder log(@Nullable Path log)
    • metricsCsv

      public PythonRewriteRpc.Builder metricsCsv(@Nullable Path metricsCsv)
    • environment

      public PythonRewriteRpc.Builder environment(Map<String,String> environment)
    • traceRpcMessages

      public PythonRewriteRpc.Builder traceRpcMessages(boolean verboseLogging)
    • traceRpcMessages

      public PythonRewriteRpc.Builder traceRpcMessages()
    • debugPort

      public PythonRewriteRpc.Builder debugPort(Path rewriteSourcePath, int debugPort)
      Set the port for Python debugger to listen on.
      Parameters:
      rewriteSourcePath - The path to the Python Rewrite source code
      debugPort - The port for the debugger to listen on
      Returns:
      This builder
    • workingDirectory

      public PythonRewriteRpc.Builder workingDirectory(@Nullable Path workingDirectory)
      Set the working directory for the Python process.
      Parameters:
      workingDirectory - The working directory for the Python process
      Returns:
      This builder
    • pipPackagesPath

      public PythonRewriteRpc.Builder pipPackagesPath(@Nullable Path pipPackagesPath)
      Set the pip packages directory for recipe installations. When set, this directory will be added to PYTHONPATH and the openrewrite package will be automatically installed if not present.
      Parameters:
      pipPackagesPath - The directory where pip packages are installed
      Returns:
      This builder
    • pythonVersion

      public PythonRewriteRpc.Builder pythonVersion(String pythonVersion)
      Set the Python language version to parse.

      Supported values:

      • "2" or "2.7" - Parse Python 2.7 code using parso
      • "3" (default) - Parse Python 3 code using the standard ast module
      Parameters:
      pythonVersion - The Python version to parse (e.g., "2", "2.7", "3")
      Returns:
      This builder
    • get

      public PythonRewriteRpc get()
      Specified by:
      get in interface Supplier<PythonRewriteRpc>