[kepler-users] Python execution within the Kepler Python actor...

Christopher Brooks cxh at eecs.berkeley.edu
Sat Nov 5 11:58:41 PDT 2011


Hi Marc,
I updated Jython to 2.5.2, it was not that hard, updating the license 
files took the most time.

I have a few of misgivings about Jython that might be good lessons for 
Ptolemy and Kepler:

* Sadly, ptII/lib/jython.jar went from about 1Mb to 10Mb.  Does this 
mean that Jython-2.5.2 is 10 times better than Jython-2.2.1?
If jython is supposed to be a scripting language, then why is it so large?
This seems to be a common trend where nice small languages get more and 
more features.
   As an aside about Perl, see
   Is Perl Better Than a Randomly Generated Programming Language? at
   
http://developers.slashdot.org/story/11/10/27/213231/is-perl-better-than-a-randomly-generated-programming-language

For comparison purposes, Ptolemy's ptsupport.jar is 3.5Mb and a 
standalone Ptolemy demo including the GUI is 6.5Mb in jars.

Lesson: we need to keep an eye on code bloat and be able to deploy small 
run times.

* Another issue with Jython-2.5.2 is that because they removed 
org.python.core.PyJavaInstance some time after Jython-2.2.1, they should 
have released Jython-2.5.2 as Jython-3.x.  Most projects bump up the 
major version number when there are incompatibilities.

Lesson: Ptolemy bumps up the major version number with each ~yearly 
release.  Ptolemy has backward compatibility filters.  We do sometimes 
remove old code, but only with major versions.

* The Jython license situation is a mess.
http://www.jython.org/license.html lists these licenses
- The Python Software Foundation License Version 2, which according to 
Wikipedia is a BSD-style license
- The Jython-2.0 and 2.1 license, which is similar to a BSD-style license
- The JPython 1.1.x license, which is similar to BSD-style license

The software ships with these licenses in the LICENSE.txt file.

However, LICENSE_CPython.txt and LICENSE_Apache.txt are included.  There 
is no mention as to what code actually uses those licenses.
LICENSE_CPython.txt includes four copyrights:
  - Python Software Foundation License Version 2
  - BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
  - CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
  - CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
The last three look similar to BSD, but have various requirements.

I'll submit a bug report to Jython to get them to update their site.

Lesson: I'm not sure how Ptolemy and Kepler can avoid a similar 
complexity issue.  I've been working on updating our license file and
we have a way to determine what licenses are used by a particular 
configuration.
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/copyright.htm
lists 7 licenses used by Ptiny, a small configuration of Ptolemy II.  
One of those 7 is the Jython-2.2.1 license, which is similar to the 
Jython-2.5.2 license.
The Kepler configuration of Ptolemy II uses 15 licenses in the Ptolemy 
II code.

_Christopher

On 11/5/11 9:15 AM, J. Marc Edwards wrote:
>
> Christopher:
>
> I suspect that I can simply code an entire actor extending the 
> respective classes directly in Jython.
>
> That is what I am thinking.  Please let me know what you think of this 
> strategy.
>
> Of course, while I do this, I want to migrate a Kepler development 
> tree to use Jython 2.5.2, which I will need your assistance in completing.
>
> Let's talk on the phone on Monday.
>
> Regards, Marc
>
> _J. Marc Edwards, Lead Architect_
>
> /Semiconductor Design Portals/
>
> *Nimbis Services, Inc.*
>
> Cell  - (919) 345-1021
>
> Fax   - (919) 882-8602
>
> Skype - (919) 747-3775
>
> jmarcedwards at gmail.com
>
> marc.edwards at nimbisservices.com
>
> *From:*Christopher Brooks [mailto:cxh at eecs.berkeley.edu]
> *Sent:* Friday, November 04, 2011 9:00 PM
> *To:* marc.edwards at nimbisservices.com
> *Cc:* kepler-users at kepler-project.org
> *Subject:* Re: [kepler-users] Python execution within the Kepler 
> Python actor...
>
> Hi Marc,
>
> On 11/4/11 2:09 PM, J. Marc Edwards wrote:
>
> I need a little help in integrating my Jython/Python code into the 
> Python actor.
>
> When I double-click on the Python actor in the PythonDialogExample, a 
> window with the Python code appears.  I can of course edit the code 
> from within this window.  However, I want to perform my code 
> development and editing from within my Eclipse environment from my 
> Kepler development build.
>
> I don't know that much about Python, but I believe that you could use 
> the Python import facility to find imports.
> I just added text to the Kepler Jython page about this, see:
> https://kepler-project.org/developers/reference/python-and-kepler#how-jython-finds-imports
>
> Note that I found a few other references on the web, included what 
> appears to be people who are using the full version of Python (not 
> Jython) with Kepler.
>
> When I "open the actor", the beginning of the file has some Javadoc as 
> well as what appear to be some unmatched XML elements (<p>), along 
> with some matching XML element tags (</pre>) (does this correspond to 
> some pre-fire method?).
>
> When you open the actor, you are seeing the Java code that implements 
> the PythonActor.  The <p> tags are html tags used in the javadoc 
> comments of the Java file.  All of the instances of the PythonActor 
> share the same Java code, but may have different Python code.
>
> After this all of the Java code for the actor follows with the 
> standard initialize(), stop(), stopFire(), preinitialize(), 
> terminate(), etc, methods.
>
> I do see in the Java code where there is a PythonScript method that 
> accepts a CompositeEntity where a script template is provided where I 
> am supposing a long Python string in the script.setExpression is defined.
>
> However, what I would like to do is simply include my Jython module 
> within my Kepler build and debug my Jython code in connection with my 
> overall workflow.
>
> Can someone tell me how to go about achieving this objective?
>
> It looks like Jython uses sys.path to find imports.  I included a 
> Ptolemy II model that opens in the devel version of Kepler that lists 
> the contents of sys.path.  For further information about sys.path, see
>
> http://jythonpodcast.hostjava.net/jythonbook/en/1.0/ModulesPackages.html
>
> _Christopher
>
>
> Thanks, Marc
>
> -- 
>
> J. Marc Edwards
> Lead Architect - Semiconductor Design Portals
> Nimbis Services, Inc.
> Skype: (919) 747-3775
> Cell:  (919) 345-1021
> Fax:   (919) 882-8602
> marc.edwards at nimbisservices.com <mailto:marc.edwards at nimbisservices.com>
> www.nimbisservices.com <http://www.nimbisservices.com>
>
>
>
>
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org  <mailto:Kepler-users at kepler-project.org>
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>
>
>
> -- 
> Christopher Brooks, PMP                       University of California
> CHESS Executive Director                      US Mail: 337 Cory Hall
> Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
> ph: 510.643.9841                                (Office: 545Q Cory)
> home: (F-Tu) 707.665.0131 cell: 707.332.0670

-- 
Christopher Brooks, PMP                       University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841                                (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20111105/271b824c/attachment.html>


More information about the Kepler-users mailing list