Package jep
Class JepConfig
java.lang.Object
jep.JepConfig
A configuration object for constructing a Jep instance, corresponding to the configuration of the particular Python sub-interpreter. This class is intended to make constructing Jep instances easier while maintaining compatible APIs between releases.
- Since:
- 3.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddIncludePaths(String... includePaths) Adds a path of directories separated by File.pathSeparator that will be appended to the sub-intepreter'ssys.pathaddSharedModules(String... sharedModule) Adds module names to the set of shared modulesCreates a new Jep instance and its associated sub-interpreter with this JepConfig.redirectStdErr(OutputStream outputStream) Redirects the Python interpreter's sys.stderr to the provided OutputStream.redirectStdout(OutputStream outputStream) Redirects the Python interpreter's sys.stdout to the provided OutputStream.setClassEnquirer(ClassEnquirer classEnquirer) Sets a ClassEnquirer to determine which imports are Python vs Java, or null for the defaultClassListsetClassLoader(ClassLoader classLoader) Sets the ClassLoader to use when importing Java classes from PythonsetIncludePath(String includePath) Sets a path of directories separated by File.pathSeparator that will be appended to the sub-intepreter'ssys.pathsetSharedModules(Set<String> sharedModules) Sets the names of modules which should be shared with other Jep sub-interpreters.setSubInterpreterOptions(SubInterpreterOptions subInterpOptions) Set the configuration options for a sub-interpreter.toString()
-
Constructor Details
-
JepConfig
public JepConfig()
-
-
Method Details
-
setIncludePath
Sets a path of directories separated by File.pathSeparator that will be appended to the sub-intepreter'ssys.path- Parameters:
includePath- directory or directories to include on sys.path- Returns:
- a reference to this JepConfig
-
addIncludePaths
Adds a path of directories separated by File.pathSeparator that will be appended to the sub-intepreter'ssys.path- Parameters:
includePaths- directories to include on sys.path- Returns:
- a reference to this JepConfig
-
setClassLoader
Sets the ClassLoader to use when importing Java classes from Python- Parameters:
classLoader- the initial ClassLoader for the Jep instance- Returns:
- a reference to this JepConfig
-
setClassEnquirer
Sets a ClassEnquirer to determine which imports are Python vs Java, or null for the defaultClassList- Parameters:
classEnquirer- the ClassEnquirer for the Jep instance- Returns:
- a reference to this JepConfig
-
redirectStdout
Redirects the Python interpreter's sys.stdout to the provided OutputStream.- Parameters:
outputStream- the Java OutputStream to redirect Python stdout to- Returns:
- a reference to this JepConfig
- Since:
- 4.0
-
redirectStdErr
Redirects the Python interpreter's sys.stderr to the provided OutputStream.- Parameters:
outputStream- the Java OutputStream to redirect Python stderr to- Returns:
- a reference to this JepConfig
- Since:
- 4.0
-
setSubInterpreterOptions
Set the configuration options for a sub-interpreter. These options are only used in Python version 3.12 or later, when using earlier versions of Python these options are ignored. These options are only used for SubInterpreter and should not be set when configuring SharedInterpreter.- Parameters:
subInterpOptions- the sub-interpreter options- Returns:
- a reference to this JepConfig
- Since:
- 4.2
-
createSubInterpreter
Creates a new Jep instance and its associated sub-interpreter with this JepConfig.- Throws:
JepException- if an error occurs- Since:
- 3.9
-
toString
-