Use the world of Python from the comfort of Scala!
ScalaPy allows you to use Python libraries from your Scala code through interfaces and conversions built on top of Jep.
ScalaPy is published to Maven Central, so you can add it by including it in your dependencies.
libraryDependencies += "me.shadaj" %% "scalapy" % "0.2.0"
To run ScalaPy apps through SBT, you will need to configure forking as well as Java options to include the Jep native libraries.
To enable forking:
fork in run := true
To add the Jep native libraries (after installing with
pip install jep):
javaOptions += "-Djava.library.path=/usr/local/lib/python3.6/site-packages/jep"
To get started with working with ScalaPy, check out the blog post introducing it.
First, build Jep and place your jep.so and libjep.jnilib files in the
lib/ folder (you will probably have to create this) for SBT to pick them up. If you do not have a libjep.jnilib file, copy the jep.so file and rename it to libjep.jnilib. These files will need to be included in the same manner for building any project that depends on ScalaPy.
When you are running, you may need to provide a path to your libraries when launching SBT by using a command such as
- NumPy: https://github.com/shadaj/scalapy-numpy
- TensorFlow: https://github.com/shadaj/scalapy-tensorflow
Logo based on https://github.com/OlegIlyenko/scala-icon with modifications to use the Python color palette.