From: Ben H. <Ben...@fi...> - 2001-05-16 10:43:12
|
[Cross-posted to Jython list from Netbeans devel, addressing JPython tool support - FYI only] Thanks Peter, David for your encouraging responses. Stepping back for a moment to a broader view, I see two potential purposes/directions for the JPython scripting features in Netbeans. 1. JPython scripting is a conveinient language to write small java-oriented scripts and to automate IDE operation. 2. JPython is an implementation of the powerful and increasingly popular language Python, and the scripting module brings initial support for Python language development to Netbeans. At a guess, I expect the current scope and intent of the scripting module support is more towards option 1: a way of scripting Java, because the IDE is Java based, (rather than a way to develop python, which occurred just as a side effect). But I would very much like to develop (J)Python in Netbeans. There is currently no IDE specifically for JPython development available - the main Python development environments are geared towards C-Python. And because JPython is executable java bytecode and thus allows effortless creation and use of java objects throughout the code, it makes sense to develop it in a java oriented IDE. To try to capture what might be required to realize option 2, ordered roughly in order of (desirability / difficulty to add): * Support for editing, running Jython code (present now) * Facility to manage important JPython properties, eg python.home in IDE. * Support for compiling and packaging JPython-based Jars * Full JPython standard libraries including python libs (/lib/*.py files) installed *Option to view truncated exception traces showing only user code stack segment, (ie only section running inside users program entry point.) * Syntax highlighting recognizes python keywords, comments, etc * Improved reporting of exceptions and errors to link code location references in messages to the editor buffer ala Java. * Code completion allowing the user to see imported members from both java and python libraries (which implies comprehension of mounted *.py files as python modules.) * Facility to auto-update the installed Jython version from a Jython site update * Debugging support (seems hard but might not be - basically about mapping between executing java bytecode and corresponding JPython source statement). So now you know my true agenda :) Sounds almost like a separate module is needed. Now, I appreciate I might be the only one who wants this, and might have to do it if I want it. But at least, I would want to coordinate such an effort, which greatly extends the scope of an existing feature, with the scripting module group to avoid working at cross-purposes. Regards Ben ----- Original Message ----- From: "Peter Zavadsky" <pet...@cz...> To: <nb...@ne...> Sent: Wednesday, May 16, 2001 8:50 AM Subject: Re: [nbdev] Using Scripting module for JPython > Hi, > > David Strupl wrote: > > > Ben Hutchison wrote: > > > >> Some comments and requests for the scripting module & JPython. > > > > > > Thanks for trying! My comments inlined: > > > > > >> I mainly use this module for the support it gives for editing and > >> running > >> JPython code. Im not a scripting module expert so some comments below > >> may be the > >> result of ignorance as to how to configure it. > >> > >> 1. Firstly, the default library packaged with Netbeans now, > >> JPython.jar, appears > >> to be quite out of date, given that the last release of JPython, 1.1, > >> was 14 > >> months ago! The project has changed name to Jython, latest release > >> 2.1a, and is > >> now Python 2.0 compatible. > > > > > > The new version (jython) is (AFAIK) already in the latest dev builds. > > You can get the new sources from CVS (main trunk), extra binaries from > > the download page and try to build the module for your self. > > Yes if you use dev builds is already there. > > > > > We plan to put the updated version on the autoupdate. Please ask > > Pet...@cz... about this. > > I have to ask about this and when it will be done let you inform. > > > > > > >> 2. To replace the JPython version, I switched the jar in the /lib/ext > >> directory, > >> restarted, and that appeared to work fine. Could this issue - > >> upgrading script > >> engines - be defined/documented please? (Im happy to contribute a > >> section for > >> Jython if needed). > > > Well it works since the Jython is compatible with JPython but shouldn't > be the most proper way since the lib/ext directory isn't > the right location for module binaries. So its better not mention this > tricky way in doc's, preffered way is the autoupdate one. > > > > > Any contribution is welcomed. Peter already moved the (new) jar to > > modules/ext. You can patch the description pages with updated info, > > create a task in issuezilla and attach the patches there. Peter or me > > will apply your patches. > > Yes Ben, your contributions are welcome. Feel free to send any > improvements to about jython and I'll be happy to put them into module. > > >> 3. There are some important properties that control Jython behavior > >> which are > >> typically specified in a registry file, which is searched for through > >> the > >> property "python.home", but can be overridden when creating a > >> PythonInterpreter > >> engine. I would like to see better support for either; a) specifying a > >> python.home from within Netbeans, or b) passing python properties > >> directly to > >> the interpreter. > >> > >> Re: option b above, the code below, from > >> org.netbeans.modules.scripting.JPythonScriptType would need to be > >> changed so > >> that the interpreter was initialized with a property set from a > >> netbeans GUI > >> form or something. > >> > >> private PythonInterpreter getInterpreter() { > >> if(pythonInterpreter == null) { > >> System.setProperty("python.cachedir", > >> System.getProperty("netbeans.user") + > >> "/system/jpythoncachedir"); > >> pythonInterpreter = new PythonInterpreter(); // <<< add > >> parameters > >> > > > > You have two options here: either create and test the requested > > patches and attach them to a issuezilla task or try to persuade Peter > > to do it for you. > > Thank you for point out this thing. > You don't have to persuade me, I see you are right. > > (Please submit an enhancement about this into issuezilla, or I'll do > that if you don't. > You'll be then informed about changes of the issue.) > > I'll have a look on it and try find some solution. The a) solution > should be easy, there is a possibility > to pass any properties to IDE when starting, for our case using > -J-Dpython.home=..., but of course its necessary to read the property in > the code :-). > I'll do that. > The second b) option -> I have to find which set of properties is useful > for jython and how to customize them. > > > > > > >> 4. There are a large nunber of python modules shipped with JPython > >> that normally > >> reside in the <JPython home>/lib directory that arent in the Netbeans > >> dist. > >> Essentially, jpython.jar is just the core and not the whole of the > >> jpython > >> system: it supports using the language syntax but not the standard > >> python APIs. > >> Granted, for some people this is all they want, but if people like me > >> want to do > >> Python development in Netbeans, they'll need the modules. > > > >> 5. Keyword highlighting in editor seems based upon Java and not > >> Python language. > >> > >> 6. Code completion likewise > >> > To the above points. I have to think about them what are the > possibilities to implement them. > > > > > Oh yes. Even more work to be done. > > > > > >> 7. In the scripting plan doc, I would have to add some > >> sub-requirements to > >> section 1.2.1 "New Console". > >> * Output appears in the console or just below. > >> * A option to truncate stack traces or send them to a different > >> window. They > >> can be very long with the majority of the stack in netbeans and python > >> interpeter and not user code. > > > I'll add those hints to the page. > > >> > >> I know there arent quick and easy fixes for many of these issues, but > >> I would > >> like to at least discuss possible solutions. > >> > Thanks as well for the many ideas. Any help from your side is welcome. > > All the best > > Peter > > -- > > Peter Zavadsky > Sun Microsystems Czech s.r.o. > http://www.netbeans.org > > |