Represents a resource that needs to be added to PYTHONPATH used by ScalaPythonBridge.
To ensure your python resources (modules, files, etc.) are properly added to the bridge,
do the following:
1) Put all the resource under some root directory with a unique name x, and make sure path/to/x
is visible to the class loader (usually just use src/main/resources/x).
2) Extend this class like this:
class MyResource extends PythonResource("x")
This assumes x is under src/main/resources/x
3) (since we use ServiceLoader) Add a file to your jar/project:
META-INF/services/spark.utils.PythonResource
with a single line containing the full name (including package) of MyResource.
This process involves scanning the entire jar and copying files from the jar to some temporary
location, so if your jar is really big consider putting the resources in a smaller jar.
Represents a resource that needs to be added to PYTHONPATH used by ScalaPythonBridge.
To ensure your python resources (modules, files, etc.) are properly added to the bridge, do the following: 1) Put all the resource under some root directory with a unique name x, and make sure path/to/x is visible to the class loader (usually just use src/main/resources/x). 2) Extend this class like this: class MyResource extends PythonResource("x") This assumes x is under src/main/resources/x 3) (since we use ServiceLoader) Add a file to your jar/project: META-INF/services/spark.utils.PythonResource with a single line containing the full name (including package) of MyResource.
This process involves scanning the entire jar and copying files from the jar to some temporary location, so if your jar is really big consider putting the resources in a smaller jar.