[ANN] cpython bindings for clojure

191 views
Skip to first unread message

Chris Nuernberger

unread,
Jun 5, 2019, 12:41:23 PM6/5/19
to clo...@googlegroups.com
Good morning Clojurians,

About 2 months ago during a talk about the tech.ml systems the point was made that if we could load the python C libraries then that would provide us with a lot more libraries to draw from.  In addition, I seem to remember one of the ML talks a concern about lack of libraries being the problem.

So, in the spirit of building bridges and providing clojure with the best possible libraries for any particular problem on the planet, I took the last month and built out raw cpython (libpython3.X) bindings based on JNA.

So, today after cleaning things up just a little bit I decided it was time to announce libpython-clj.  My hope is that there are enough clojuian pythonistas that we can take this library and make it an absolute joy to work with; the best python hosting environment that exists.


Some features include:

* Python dicts are represented in java as java.util.Map's.
* stdout,stderr are overridden to write to *out* and *err*, respectively.
* transparent access to the python interpreter from any thread.
* zero-copy pathways for numpy->tech.datatype tensors and back.  So you can intermix heavy processing between clojure and python without pay a large conversion cost.
* Decent performance.  This is built on the raw cpython shared library so our cost of executing or interoperating with python should not be any higher than anyone else's.
* two way bridging.  Expose your JVM objects to python and vice versa.

I have a simple keras demo where I use Keras from clojure to train a neural network included in the examples.  So that proves out keras and tensorflow access from clojure.

I think this soundly addresses our ability to load cutting edge math and machine learning libraries.

Jonah Benton

unread,
Jun 5, 2019, 12:59:12 PM6/5/19
to clo...@googlegroups.com
Wow, that is incredibly cool. Eager to check it out.


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CADbpEJvOWoxZu0Y_LHi%2B36bEbcOfxCV5n0jd7mhvq8TO9MaD_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

John Newman

unread,
Jun 5, 2019, 1:02:26 PM6/5/19
to clo...@googlegroups.com

Rick Mangi

unread,
Jun 5, 2019, 1:26:27 PM6/5/19
to clo...@googlegroups.com
OMG, maybe this will get my DS team more interested in clojure.

Fantastic job!


For more options, visit https://groups.google.com/d/optout.


--

chartbeat-gmail-bar@2x.png

Rick Mangi

Senior Director of Data Engineering

Chartbeat

917.848.3619 | @rmangi | ri...@chartbeat.com

826 Broadway, 6th Fl., New York, NY 10003

Alan Moore

unread,
Jun 5, 2019, 8:40:14 PM6/5/19
to Clojure
Awesome!

Alan

Daniel Carleton

unread,
Jun 6, 2019, 2:29:47 AM6/6/19
to clo...@googlegroups.com
Excellent! I'd just been considering with trepidation trying to use jython for something when your message appeared. 

On Wed, Jun 5, 2019, 5:40 PM Alan Moore <kahun...@coopsource.org> wrote:
Awesome!

Alan


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

Mattias Arro

unread,
Jun 8, 2019, 7:06:48 PM6/8/19
to Clojure
This is beyond cool. Thank you so much for putting this together!
Reply all
Reply to author
Forward
0 new messages