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 base pip packages directory. When set and the required release version is not already available in the Python interpreter, a version-specific subdirectory (e.g., <pipPackagesPath>/8.74.1/) is resolved and the openrewrite package is automatically installed there via pip. Dev builds (.dev0) are not installed this way and require the interpreter to already have the package.
      Parameters:
      pipPackagesPath - The base directory under which version-specific pip packages are installed
      Returns:
      This builder
    • recipeInstallDir

      public PythonRewriteRpc.Builder recipeInstallDir(@Nullable Path recipeInstallDir)
      Set the directory where user-installed recipe packages live. This directory is added to PYTHONPATH so the RPC server can find recipe packages installed via pip.
      Parameters:
      recipeInstallDir - The directory containing recipe pip packages
      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>