Hacker News new | ask | show | jobs
by KenCochrane 5201 days ago
What is the typical use case for Jython? Is it so that people can run Python at companies that only run Java? In that use case, I'm assuming people are creating a python app, and then compiling a War, and then deploying on Tomcat or Jetty?
3 comments

I can think about the power of Python scripting + the rich world of Java libraries/frameworks.

My main use is for web scraping + javascript support, since I love Python and I like the HTMLUnit headless browser written in Java. I've written two articles using it:

i) http://blog.databigbang.com/web-scraping-ajax-and-javascript...

ii) http://blog.databigbang.com/automated-browserless-oauth-auth...

Yup, banks don't like Python, but Java is OK. So you write your Java in Jython, package it up & deploy.

Here's another use case. At Repustate, we have an API to create PowerPoint presentations via an API call. We use Apache POI (Java) to create & manage PowerPoint slides, but our code base is all Python. So we have a Jython process running on Jetty, but instrument all of the Java bits with Python.

It's pretty amazing to have all of the power of the JVM at your disposal but with the grace of Python.

It's been a while, but I recall a Java shop where the (complicated) build process was written in Jython.
yeah that is pretty cool.
This and if you have a large (sometimes legacy) JVM-based (i.e. not just Java, but Scala or Clojure as well) code base that you want to integrate with Python: Hadoop and Weka come to mind.
I see. Can you access/call the java/scala/closure classes from inside of your python code? If so, that is pretty cool.