Package org.openrewrite.python.rpc
Class PythonRewriteRpc.Builder
java.lang.Object
org.openrewrite.python.rpc.PythonRewriteRpc.Builder
- All Implemented Interfaces:
Supplier<PythonRewriteRpc>
- Enclosing class:
PythonRewriteRpc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the port for Python debugger to listen on.environment(Map<String, String> environment) get()marketplace(org.openrewrite.marketplace.RecipeMarketplace marketplace) metricsCsv(@Nullable Path metricsCsv) pipPackagesPath(@Nullable Path pipPackagesPath) Set the base pip packages directory.pythonPath(Path pythonPath) Path to the Python executable.pythonPath(Supplier<@Nullable Path> pythonPathSupplier) Supplies the path to the Python executable.pythonVersion(String pythonVersion) Set the Python language version to parse.recipeInstallDir(@Nullable Path recipeInstallDir) Set the directory where user-installed recipe packages live.traceRpcMessages(boolean verboseLogging) workingDirectory(@Nullable Path workingDirectory) Set the working directory for the Python process.
-
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
Path to the Python executable.- Parameters:
pythonPath- The path to the Python executable (e.g., "python3", "/usr/bin/python3")- Returns:
- This builder
-
pythonPath
Supplies the path to the Python executable. The supplier is invoked at most once, when the RPC is first started. Returningnulluses the built-in default (same as not configuring the path at all). Exceptions thrown by the supplier propagate out of the RPC-start call.- Parameters:
pythonPathSupplier- Supplier for the path to the Python executable- Returns:
- This builder
-
timeout
-
log
-
metricsCsv
-
environment
-
traceRpcMessages
-
traceRpcMessages
-
debugPort
Set the port for Python debugger to listen on.- Parameters:
rewriteSourcePath- The path to the Python Rewrite source codedebugPort- The port for the debugger to listen on- Returns:
- This builder
-
workingDirectory
Set the working directory for the Python process.- Parameters:
workingDirectory- The working directory for the Python process- Returns:
- This builder
-
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
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
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
- Specified by:
getin interfaceSupplier<PythonRewriteRpc>
-