Class PythonRewriteRpc

java.lang.Object
org.openrewrite.rpc.RewriteRpc
org.openrewrite.python.rpc.PythonRewriteRpc

public class PythonRewriteRpc extends org.openrewrite.rpc.RewriteRpc
  • Method Details

    • get

      public static @Nullable PythonRewriteRpc get()
    • getOrStart

      public static PythonRewriteRpc getOrStart()
    • setFactory

      public static void setFactory(PythonRewriteRpc.Builder builder)
    • shutdown

      public void shutdown()
      Overrides:
      shutdown in class org.openrewrite.rpc.RewriteRpc
    • shutdownCurrent

      public static void shutdownCurrent()
    • resetCurrent

      public static void resetCurrent()
      Resets the cached state of the current Python RPC instance. This clears all parsed objects and references on both the Java and Python sides, preventing memory accumulation across multiple parse operations.

      Call this between tests or after batch operations that don't need to share state.

    • parseProject

      public Stream<org.openrewrite.SourceFile> parseProject(Path projectPath, org.openrewrite.ExecutionContext ctx)
      Parses an entire Python project directory. Discovers and parses all relevant source files.
      Parameters:
      projectPath - Path to the project directory to parse
      ctx - Execution context for parsing
      Returns:
      Stream of parsed source files
    • parseProject

      public Stream<org.openrewrite.SourceFile> parseProject(Path projectPath, @Nullable List<String> exclusions, org.openrewrite.ExecutionContext ctx)
      Parses an entire Python project directory. Discovers and parses all relevant source files.
      Parameters:
      projectPath - Path to the project directory to parse
      exclusions - Optional glob patterns to exclude from parsing
      ctx - Execution context for parsing
      Returns:
      Stream of parsed source files
    • parseProject

      public Stream<org.openrewrite.SourceFile> parseProject(Path projectPath, @Nullable List<String> exclusions, @Nullable Path relativeTo, org.openrewrite.ExecutionContext ctx)
      Parses an entire Python project directory. Discovers and parses all relevant source files.
      Parameters:
      projectPath - Path to the project directory to parse
      exclusions - Optional glob patterns to exclude from parsing
      relativeTo - Optional path to make source file paths relative to
      ctx - Execution context for parsing
      Returns:
      Stream of parsed source files
    • builder

      public static PythonRewriteRpc.Builder builder()