Differences between revisions 16 and 17
Revision 16 as of 2006-07-11 03:20:36
Size: 7591
Editor: 12-214-79-52
Comment:
Revision 17 as of 2006-07-11 03:38:36
Size: 7741
Editor: 12-214-79-52
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:

Questions, comments, or suggestions???

Please send email to:

jython-monthly@mchsi.com or jython-users@lists.sourceforge.net for discussion.

Jython Monthly

http://www.jython.org/css/jython.png

July 2006 -- Issue #1

Welcome to the first issue of Jython Monthly. The content of this newsletter will focus on using and developing the Jython languge. I hope that you are able to find some content which will interest you. I look forward to editing and distributing this newsletter monthly, and I hope you look forward to reading it.

- Josh Juneau

Questions, comments, or suggestions???

Please send email to:

jython-monthly@mchsi.com or jython-users@lists.sourceforge.net for discussion.

Articles

Standalone mode - Libraries included

http://wiki.python.org/jython/JythonMonthly/Articles/July2006/2

Submitted by: Oti

Jython has now a standalone mode, where the core part is all included in one single jython.jar file. This has two advantages:

  • simpler starting: java -jar jython.jar

  • simpler embedding: just put jython.jar onto your classpath. No setting of python.home nor python.path required.

This really adds a Plug & Play feature to Jython.

There is a preview available ([http://homepage.sunrise.ch/mysunrise/ohumbel/jython_2837.jar snapshot build]).

A sample install and run session, after downloading jython_2837.jar:

[root@localhost downloads]# java -jar jython_2837.jar -s -d /tmp/jython_standalone -t standalone
Performing silent installation
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
Packing standalone jython.jar ...
 90 %
 100 %
Congratulations! You successfully installed Jython HEAD to directory /tmp/jython_standalone.

[root@localhost downloads]# cd /tmp/jython_standalone/
[root@localhost jython_standalone]# ls
jython.jar

[root@localhost jython_standalone]# java -jar jython.jar 
*sys-package-mgr*: processing new jar, '/tmp/jython_standalone/jython.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/rt.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jsse.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jce.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/charsets.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunjce_provider.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/localedata.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunpkcs11.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/dnsns.jar'
Jython 2.2a1 on java1.5.0_07 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/tmp/jython_standalone/.', '/tmp/jython_standalone/./Lib', '/tmp/jython_standalone/jython.jar/Lib']
>>> import getopt
>>> 

One Open issue: the cachedir problem still remains. If the directory containing jython.jar is not writable, no cachedir will help importing java classes. This is a well known problem also persistent in non-standalone mode. We try to improve this in standalone mode.

Extending on the FAQ -- Accessing your Jython code from Java and Using Reflection to Access

Extending on the Jython User FAQ section for embedding Jython, this article details the jythonc utility and possible uses.

http://wiki.python.org/jython/JythonMonthly/Articles/July2006/1

Submitted by: Josh Juneau

Tips and Tricks

Jython Function Behavior

A useful thing to note about defining Jython functions with keyword parameters: The default values are only created once, at function compilation-time.

For instance, if the default value you’re supplying is MyClass(5, 6, 7), you might be surprised to discover that the same instance gets used with every function call.

This trick can be used to make an equivalent to C’s static local variables. Try this:

def foo(item, acc=[]):
    acc.append(item)
    return acc

Now call foo a few times providing different numbers.

>>> foo(5)
[5]
>>> foo(6)
[5, 6]
>>> foo(7)
[5, 6, 7]

I’m sure there are much more interesting uses for this than my contrived little example, but you get the idea.

Source : http://oakwinter.com/code/?p=29

How to use the Wiki

Learn to use the Jython wiki for posting articles and tutorials. Help and build the Jython library! Wiki renders as html and can use css and images. It is a great tool for posting content quickly in an organized environment. Create an account and use the wiki help to get started today.

http://wiki.python.org/jython/HelpContents

Here is an example provided by Clark Updike:

Here's the main page (rendered as HTML): http://wiki.python.org/jython/FrontPage

And here's the raw text (what had to be typed to create it): http://wiki.python.org/jython/FrontPage?action=raw

BECOME THE FIRST JYTHON DEVELOPER ON SUN GRID AND WIN YOUR SHARE OF $50,000 IN PRIZES!

Test your skills with the Coolaps Developer Challenge: There are two ways to compete - the best application that runs on Sun Grid Compute Utility, and the best application built with the Compute Server Plugin for NetBeans. We designed things this way to allow as many people as possible to participate, including International participants, who cannot access the Sun Grid Compute Utility today.

Learn more about the Coolapps Developer Challenge: https://coolapps.developer.network.com/

Off The Lists

Pydev and Pydev Extensions 1.2.1 have been released

Details on Pydev Extensions: http://www.fabioz.com/pydev

Details on Pydev: http://pydev.sf.net

Details on its development: http://pydev.blogspot.com

Question from leouser to the community

Id like to compile a list of things that would improve [https://jythonshell.dev.java.net Jython Shell] and am curious if there are any users out there in the general Jython community that have any ideas.

I have one: Let the user alter the font from the GUI. After taking the shell to different platforms, Ive come to the conclusion that just using the supplied font is not always a good thing. Im considering adding a font chooser panel. Something at least that will let the user change the blasted font.

Any other ideas? Please send thoughts to the Jython-Users list

https://jythonshell.dev.java.net/

Interested in Developing Jython?

If you are interested in developing Jython, please take a look at the [http://sourceforge.net/tracker/?func=browse&group_id=12867&atid=112867 current bug listing] and submit patches for items which you can repair.

Who's Using Jython?

Dojo Toolkit

The Dojo Javascript Toolkit is utilizing Jython's ANT capabilites for their build process. Take a look at this powerful toolkit...it is worth the time! http://dojotoolkit.org

Useful Links

Articles

[http://www.devshed.com/c/a/Python/Introduction-to-Jython/ Intro to Jython]

[http://today.java.net/pub/a/today/2003/06/10/jython.html Scripting with Jython Instead of XML]

Tutorials

[http://www.rexx.com/~dkuhlman/jython_course_01.html#compiling-jython-to-and-for-java Online Jython Course]

Links

[http://www.jython.org Jython Home]

[http://www.python.org Python Home]

[http://en.wikipedia.org/wiki/Jython Jython WikiPedia]

[http://freshmeat.net/projects/jython/ Freshmeat.net]

JythonMonthly/Newsletters/July2006 (last edited 2008-11-15 09:15:57 by localhost)