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.path
addSharedModules
(String... sharedModule) Adds module names to the set of shared modulesDeprecated.Creates a new Jep instance and its associated sub-interpreter with this JepConfig.setClassEnquirer
(ClassEnquirer classEnquirer) Sets a ClassEnquirer to determine which imports are Python vs Java, or null for the defaultClassList
setClassLoader
(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.path
setInteractive
(boolean interactive) Deprecated.Interactive mode will be removed in a future release.setRedirectOutputStreams
(boolean redirectOutputStreams) Sets whether to redirect the Python sys.stdout and sys.stderr streams to the Java System.out and System.err streamssetSharedModules
(Set<String> sharedModules) Sets the names of modules which should be shared with other Jep sub-interpreters.
-
Constructor Details
-
JepConfig
public JepConfig()
-
-
Method Details
-
setInteractive
Deprecated.Interactive mode will be removed in a future release. See console.py for an example of how to interactively execute Python using the builtin compile() and exec() functions.Sets whetherJep.eval(String)
should support the slower behavior of potentially waiting for multiple statements- Parameters:
interactive
- whether the Jep instance should be interactive- Returns:
- a reference to this JepConfig
-
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
-
setRedirectOutputStreams
Sets whether to redirect the Python sys.stdout and sys.stderr streams to the Java System.out and System.err streams- Parameters:
redirectOutputStreams
- whether to redirect Python streams to Java- Returns:
- a reference to this JepConfig
-
createJep
Deprecated.UsecreateSubInterpreter()
instead.Creates a new SubInterpreter instance and its associated sub-interpreter with this JepConfig.- Returns:
- a new Jep instance
- Throws:
JepException
- if an error occurs- Since:
- 3.8
-
createSubInterpreter
Creates a new Jep instance and its associated sub-interpreter with this JepConfig.- Returns:
- a new SubInterpreter instance
- Throws:
JepException
- if an error occurs- Since:
- 3.9
-
createSubInterpreter()
instead.