Toolkits > com.ibm.streamsx.topology 2.1.0 > com.ibm.streamsx.topology.python > Creating SPL Operators from Python code > Extracting SPL operators from Python
To create SPL operators in a toolkit, execute:
spl-python-extract -i toolkit-directory
When not using the streamsx package then the extraction script is available in the bin directory of this toolkit.
python3 spl-python-extract.py -i toolkit-directory
Any Python module in the toolkit's opt/python/streams directory will have its decorated classes and functions converted to SPL operators.
A single Python embedded runtime is used by an SPL processing element (PE), thus when multiple operators implemented in python are fused into the same PE they share the same runtime. The library and include paths to the Python runtime are set from the version of Python used to execute spl-python-extract.
The toolkit has no dependency on this toolkit (com.ibm.streamsx.topology) once spl-python-extract has been executed.
The sample SPL toolkit samples/python/com.ibm.streamsx.topology.pysamples contains opt/python/streams/spl_samples.py for examples of how data is passed into and out of Python from SPL, using positional arguments.
E.g.
spl-python-extract -i samples/python/com.ibm.streamsx.topology.pysamples
usage: spl-python-extract [-h] -i DIRECTORY [--make-toolkit] Extract SPL operators from decorated Python classes and functions. optional arguments: -h, --help show this help message and exit -i DIRECTORY, --directory DIRECTORY Toolkit directory --make-toolkit Index toolkit using spl-make-toolkit