Skip to content

Use cljbridge python lib #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 0 additions & 212 deletions cljbridge.py

This file was deleted.

25 changes: 13 additions & 12 deletions topics/embedded.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,20 @@ Due to the above reasons there is a solid argument for, if possible, embedding
Clojure into Python allowing the Python executable to be the host process.


## Enter: javabridge
## Enter: cljbridge


Python already had a nascent system for embedding Java in Python - the
[javabridge module](https://pypi.org/project/javabridge/). You will need to have
javabridge installed in your Python environment. In order to compile `javabridge`
requires the JDK installed and **not just the JRE**. [tristanstraub](https://github.com/tristanstraub/)
[javabridge module](https://pypi.org/project/javabridge/).

We went a step further and provide `cljbridge` python module.

In order to compile `javabridge`
a JDK is required and **not just the JRE**. [tristanstraub](https://github.com/tristanstraub/)
had found a way to use this in order to work with [Blender](https://github.com/tristanstraub/blender-clj/).
We took a bit more time and worked out ways to smooth out these interactions
and make sure they were supported throughout the system.

```console
python3 -m pip install javabridge
```

If the installation cannot find 'jni.h' then most likely you have the Java runtime
(JRE) installed as opposed to the Java development kit (JDK).


## From the Python REPL

Expand All @@ -56,9 +52,14 @@ which can be installed via

```
export JAVA_HOME=<--YOUR JAVA HOME-->
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple cljbridge
python3 -m pip install cljbridge
```

This will install and eventually compile `javabridge` as well.

If the installation cannot find 'jni.h' then most likely you have the Java runtime
(JRE) installed as opposed to the Java development kit (JDK).

So we start by importing
that script:

Expand Down