ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-users
Jython-users
[Jython-users] Re: Epydoc: kludge-ability for Jython
by George Sakkis other posts by this author
Nov 23 2004 7:12PM messages near this date
Re: [Jython-users] [NOOB] importing python stuff stored elsewhere... | Fwd: [Jython-users] Importing Java Source Code to Jython
Hi Jeremy,

I was having the same problem. The first thing you may want to do, if you
haven't already, is consider HappyDoc (happydoc.sourceforge.net);
unlike most doc tools, happydoc doesn't try to import anything so it
works out of the box for jython too.

Now, I didn't really find the look and feel of happydoc as good as epydoc,
so I hacked it a little and made the simplest thing that worked for me,
that is ignore the files with import failures. The idea is to replace the
builtin __import__ with a custom function __force__import__ that always
succeeds and returns a dummy module-like object. Actually it was a bit
more involved than that because epydoc performs in several places strict
type checks of the form "if type(x) is types.ModuleType:..." so these have
to be relaxed too.

The hack makes epydoc create entries for every module. Unfortunately,
this alone is useless if your whole code is in jython, because currently
the dummy module-like object doesn't know anything about an unimportable
module except for it's name, so the documentation page for it is empty.
This wasn't a big problem for me since most of my code did not require
specifically jython.

Of course, one could in principle make the dummy module-like object
more "real" by parsing the module file instead of __import__ing it. This
is more or less what happydoc does, so it's probably easier to start from
there instead of reinventing the wheel. By the way, I think that's in
epydoc's todo list.

Making epydoc run from jython without parsing the module files might be
doable too, though I haven't looked into the details.

George



>  Hi folks,
> 
>  I'm working on a project in Jython which imports several Java packages,
>  and have been trying to kludge Epydoc so that, EITHER:
>          - Epydoc would ignore the import failures which happen when my
>            Jython code is run under Python, OR (less feasibly)
>          - Epydoc would run in Jython, and so be able to see the pacakges
>            (although I don't know what it'd 'see').
> 
>  I have effectively driven myself crazy in my vain efforts.
> 
>  Does anyone have any suggestions for what might work?
> 
>  Jeremy


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved