clj-python / libpython-clj

Python bindings for Clojure
Eclipse Public License 2.0
1.08k stars 68 forks source link

can we have cljbridge.py in pypi ? #178

Closed behrica closed 2 years ago

behrica commented 2 years ago

Not having it as a proper python module, makes some integrations difficult

cnuernber commented 2 years ago

Sure, nothing is stopping someone from doing that :-).

behrica commented 2 years ago

I gave it a first shot. I am completely newby on python packages, but I manged to upload something on the test-pypy https://test.pypi.org/simple/

The following command works for me on an empty virtualenv and in an empty Docker after installing python3 and java and clojure.

The package declares a dependency to python-javabridge

export JAVA_HOME=.....
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple  cljbridge

This might install python-javabridge which only works if JAVA_HOME is set.

inside python:

from clojurebridge import cljbridge
cljbridge.init_jvm(start_repl=True,port=12345,bind='0.0.0.0')

@cnuernber , maybe you could try it out ones. As I'm very new to python packages, I am not sure if I did a valid package. I looks like it, at least

behrica commented 2 years ago

Code of the package is here: https://github.com/behrica/clojurebridge It uses "current cljbridge.py" from here: https://github.com/clj-python/libpython-clj/blob/master/cljbridge.py

behrica commented 2 years ago

Once we have done this, we could go step further and make sure that the embedded repl started by python honors "deps.edn" and constructs the same classpath as a Clojure CLI would. The needed pieces for this are here: https://github.com/clojure/tools.deps.alpha

behrica commented 2 years ago

PR: https://github.com/clj-python/libpython-clj/pull/184

behrica commented 2 years ago

Done: https://pypi.org/project/cljbridge

behrica commented 2 years ago

can be closed