#jython IRC Log


IRC Log for 2017-05-24

Timestamps are in GMT/BST.

[2:24] * lopex (uid4272@gateway/web/irccloud.com/x-ryjleulvdtbneupn) Quit (Quit: Connection closed for inactivity)
[3:37] <topi`> jimbaker: nothing interesting in trace. It just seems that with django 1.11, "jython manage.py runserver" gets empty {} from argparse where it should at least contain the default values...
[3:39] <topi`> parser.add_argument('--nothreading', action='store_false', dest='use_threading', default=True)
[3:39] <topi`> see, the stuff to get the default values in place (from argparse) is there, but still, **options ends up empty {}
[3:40] <topi`> the superclass defines create_parser() which creates a CommandParser()
[3:40] <topi`> this works with CPython. Very odd.
[4:02] <topi`> jimbaker: can I somehow import a java class that was compiled in a flat hierarchy? e.g. stuff/MyClass.java where stuff is in django's PYTHONPATH
[4:03] <topi`> I guess I should be able to import anything that lives inside a jar.
[4:03] <jimbaker> topi`, i don't recall the exact logic, but it gets tricky when it's mixed like that
[4:03] <jimbaker> best to import from a jar
[4:03] <topi`> I have 24 hours time to prepare my presentation :D
[4:03] <topi`> slightly backlogged here...
[4:03] <jimbaker> vs attempting to mix java and python code in one directory tree
[4:04] <topi`> I intend to create a custom class both in python and java and import that class from a Django view
[4:04] <topi`> to demonstrate that you can rewrite compute intensive parts in java
[4:05] <topi`> the second demo is about integrating a piece of python code (say, using os.walk() to walk a filesystem tree and recursively calculate sha1 hashes from files) into existing java code
[4:05] <topi`> so, clamping
[4:05] <jimbaker> sounds good. important info: if it's in a jar, it can live anywhere - location of jar just needs to be on CLASSPATH (or equiv sys.path)
[4:06] <topi`> yeah, it's been a few years since I did some major effort wrt integrating jython and java, but I still rememver some bits :)
[4:06] <topi`> I think django was at 1.6 back then
[4:07] <topi`> do you have an explanation as why "import requests" takes a long long time?
[4:07] <jimbaker> i have not worked with django for a number of years at this point. funny, used to work it with extensively
[4:07] <topi`> some other imports go a lot faster
[4:08] <topi`> hmm, tab completion is missing from my jython installation. Any ideas why?
[4:09] <topi`> I set up a virtualenv with virtualenv -p /usr/local/bin/jython myenv
[4:09] <topi`> Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[4:09] <topi`> funny, but this is already 2 years old!
[4:10] <jimbaker> yep, that's how time flies!
[4:10] <topi`> I think that shows how little hands there are on jython code
[4:10] <topi`> how few hands
[4:10] <jimbaker> that too
[4:10] <topi`> the jython3 is going to be a major effort
[4:10] <jimbaker> on the flip side, it shows how few hands are requrired
[4:11] <topi`> hopefully I can convert some souls from our corporate for contributions
[4:11] <topi`> we have ~90 java guys
[4:11] <topi`> some have gone to the Dark Side (e.g. Scala) ;)
[4:11] <jimbaker> yes, but i will point out that the runtime is not so different between cpython 2.7 and cpython 3.3
[4:11] <jimbaker> so some advances since then
[4:12] <topi`> we want the asyncio stuff and 3.5
[4:12] <jimbaker> and we have a number of backports from 3.5 into what will be jython 2.7.1 at this point
[4:12] <jimbaker> re ssl
[4:12] <jimbaker> and other aspects
[4:12] <topi`> does ssl still work in the way 2.7 users expect it?
[4:12] <jimbaker> that is cpython 2.7.12
[4:13] <topi`> oh, ok
[4:13] <jimbaker> topi`, we have pip and requests demonstrating compatibility for us
[4:13] <jimbaker> so it should be
[4:13] <jimbaker> plus the work to make twisted/ssl to work on jython that datastax contributed and is using
[4:13] <topi`> requests works for some basic GETs already now in 2.7.0
[4:14] <jimbaker> i would try 2.7.1 trunk
[4:14] <jimbaker> i need to see if the latest fix is more or less what will be our RC...
[4:15] <jimbaker> so damn close
[4:20] <jimbaker> topi`, yep, it works as expected. we are working out the jar refresh, and hopefully nothing breaking there
[4:20] <jimbaker> getting back to the specific async functionality, i think we should target 3.6 so we get async and await
[4:20] <jimbaker> plus typing
[4:21] <jimbaker> as i mentioned on jython-dev
[4:22] <jimbaker> it's going to be a fair amount of work, but the real pain to implement has been runtime stuff. language features, that's so easy
[4:23] <jimbaker> and given the level of compatibility we have in our socket support now; and the fact that we can first layer asyncio on our sockets, then rewrite to use netty directly (similar to what was done with uvloop), i'm actually optimistic about the level of work required
[4:24] <topi`> yeah, typing would be cool
[4:25] <jimbaker> typing that can work with java would be very cool
[4:25] <topi`> I could think of the realm of optimization opportuinities
[4:26] <topi`> jython emits direct JVM bytecode on those $class files, right?
[4:27] <topi`> how is a for loop represented? does it just do type checks on every single loop iteration on all exposed variables?
[4:27] <jimbaker> it's direct bytecode now, but it could be optimized to be idiomatic bytecode
[4:28] <topi`> what about java's InvokeDynamic machinery, how does it work?
[4:28] <topi`> sorry, too many questions :) I also have an audience who might ask hard questions
[4:28] <jimbaker> invokedynamic is not so interesting without other optimizations
[4:29] <jimbaker> i worked with a masters student, and it requires a bit more than just replacing use of reflection with invokedynamic
[4:30] <jimbaker> but i can tell you, if we have types, we can do far better
[4:31] <jimbaker> based on those same experiments
[4:31] <jimbaker> such as optimizing for loops, function calls, etc
[4:31] <jimbaker> anyway, discussion for another time, i got to pack for a trip tomorrow!
[4:31] <jimbaker> but please check out latest jython trunk because hopefully we are going to ship this
[4:32] <jimbaker> and get to work on 2.7.2 and for real on jython 3
[4:32] <jimbaker> jython 3.6 to be precise
[4:35] * NickGoingUp (ca8e3f1a@gateway/web/freenode/ip. has joined #jython
[4:41] <topi`> Exception in thread "MainThread" java.lang.NullPointerException at org.python.util.jython.shutdownInterpreter(jython.java:439)
[4:41] <topi`> it seems jython doesn't like Django's autoloading mechanism
[4:42] <topi`> this (in Lib/_socket.py):
[4:42] <topi`> self.cv.wait(timeout)
[4:42] <topi`> java.lang.InterruptedException at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2088)
[4:43] <topi`> what does this "interruptedException" actually mean?
[4:46] <topi`> oh, also "jython manage.py shell" fails. _socket.error: [Errno 9] Bad file descriptor: <open file '<stdin>', mode 'r' at 0x76>
[4:47] <topi`> so maybe some slight incompatibility with cpython wrt sockets
[4:47] <topi`> if sys.platform != 'win32' and select.select([sys.stdin], [], [], 0)[0]:
[4:48] <topi`> there is some interesting sys.platform inspection there..
[4:48] <topi`> it's problematic, because java isn't really win32 or even unix... it's java
[5:00] * NickGoingUp (ca8e3f1a@gateway/web/freenode/ip. Quit (Quit: Page closed)
[5:01] * Cust0sLimen (~CustosLim@unaffiliated/cust0slim3n) Quit (Ping timeout: 255 seconds)
[5:06] * Cust0sLimen (~CustosLim@unaffiliated/cust0slim3n) has joined #jython
[5:44] <topi`> ok, demo 1 almost finished :)
[5:44] <topi`> the python code renders a mandelbrot fractal at 800x800 pixels in 17 seconds
[5:44] <topi`> the java code (but it's ugly) renders it in 0.2 seconds
[5:48] <topi`> I ran the python code second time and now only 12 seconds
[6:10] <topi`> interesting... I can import my Mandelbrot class in jython just fine if I just setup CLASSPATH to point to the right path, but from within Django that import fails
[6:11] <topi`> java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: fractalshop/Mandelbrot (wrong name: Mandelbrot)
[6:11] <topi`> hmm, this might be because it added that "fractalshop/" in front of it... I wonder where it comes from
[6:12] <topi`> how can I configure javac to use a certain path for the module?
[6:21] <topi`> do I need to put a MANIFEST.MF in my jar?
[7:29] <topi`> it seems I'm unable to create a .jar file from my java .class that jython would actually load...
[7:32] <topi`> jar -tf lists this as:
[7:32] <topi`> META-INF/MANIFEST.MF
[7:32] <topi`> fractalshop/Mandelbrot.class
[7:32] <topi`> then:
[7:32] <topi`> >>> import fractalshop.Mandelbrot
[7:32] <topi`> java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: fractalshop/Mandelbrot (wrong name: Mandelbrot)
[7:33] <topi`> this is a different error than from "import Mandelbrot" which it plainly refuses to do
[7:33] <topi`> it just says no module named Mandelbrot
[8:55] <topi`> solved. I needed to declare "package x.x.x.x;" in my .java file
[8:55] <topi`> jython would refuse to load from a .jar, unless the module was fully qualified
[9:37] * girish946 (~gsjoshi@ has joined #jython
[9:46] * girish946 (~gsjoshi@ Quit (Quit: Leaving)
[10:25] * lopex (uid4272@gateway/web/irccloud.com/x-wtmbwnhyogqmbuig) has joined #jython
[12:38] * xemdetia (xemdetia@nat/ibm/x-nhhlnmpsybctcjze) has joined #jython
[13:21] * girish946 (~gsjoshi@ has joined #jython
[14:20] * stewori (~stefan@ip-95-223-198-21.hsi16.unitymediagroup.de) has joined #jython
[14:51] * girish946 (~gsjoshi@ Quit (Quit: Leaving)
[17:35] * stewori (~stefan@ip-95-223-198-21.hsi16.unitymediagroup.de) Quit (Quit: Leaving.)
[21:15] * stewori (~stefan@ip-95-223-198-21.hsi16.unitymediagroup.de) has joined #jython


These logs were automatically created by JythonLogBot on irc.freenode.net using a slightly modified version of the Java IRC LogBot.