https://github.com/scalapy/sbt-scalapy
Automatic SBT configuration for ScalaPy
https://github.com/scalapy/sbt-scalapy
Last synced: 7 months ago
JSON representation
Automatic SBT configuration for ScalaPy
- Host: GitHub
- URL: https://github.com/scalapy/sbt-scalapy
- Owner: scalapy
- License: bsd-3-clause
- Created: 2022-04-21T12:40:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-24T08:44:03.000Z (over 3 years ago)
- Last Synced: 2023-03-09T03:21:32.278Z (over 3 years ago)
- Language: Scala
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Automatic SBT configuration for ScalaPy
*supports both JVM and/or Scala Native projects*

## Quick start
1. Add the plugin to `project/plugins.sbt`
```scala
addSbtPlugin("ai.kien" % "sbt-scalapy" % "")
```
2. Enable the plugin for your ScalaPy project in `build.sbt`
```scala
enablePlugins(ScalaPyPlugin)
```
`sbt-scalapy` would then configure the project to use the `python` in your current environment. If you want to use another Python version, set the `scalapyPythonExecutable` key to the interpreter executable,
could be the absolute path
```scala
scalapyPythonExecutable := "/absolute/path/to/python"
```
or just the name of the executable if it's already in `PATH`
```scala
scalapyPythonExecutable := "python3.9"
```
## Advanced
### JVM
ScalaPy for JVM requries the name and location of `libpython`. You can set these manually instead of letting the plugin automatically figure it out,
```scala
scalapyPythonNativeLibrary := "python3.9m"
scalapyPythonNativeLibraryPaths := Seq(
"/first/directory/to/look/for/libpython",
"/second/directory/to/look/for/libpython"
)
```
### Scala Native
ScalaPy for Scala Native requries [the linker flags for embedding Python](https://docs.python.org/3/extending/embedding.html#compiling-and-linking-under-unix-like-systems). You can set this manually instead of letting the plugin automatically figure it out,
```scala
scalapyLinkingOptions := Seq("-l...", "-l...")
```
## Virtualenv
To use a virtualenv Python, you can either activate the virtualenv then start sbt or set `scalapyPythonExecutable` to the virtualenv Python executable.
For Scala Native, you also need to set the `SCALAPY_PYTHON_PROGRAMNAME` environment variable to the virtualenv Python executable,
```sh
SCALAPY_PYTHON_PROGRAMNAME="/path/to/python" sbt
```