2011/9/21 Arnaud Delobelle <arnodel@gmail.com>
Is it possible to slim down jython.jar by shedding most of the modules
in the standard library?  If yes, how difficult is it?  This project
is my first encounter with jython and I have only been coding in Java
since July, so I guess I am quite a neophyte.



I suggest to replace the __import__ to log what is imported so you'll know what are your dependencies. It could be something like that:

import __builtin__

# Keep the old importer:
old_import  = __builtin__.__import__

# New importer function:
def log_import(name, globals={}, locals={}, fromlist=[], level=-1):
   print name
   print fromlist
   return old_import(name, globals, locals, fromlist, level)

# Replace the importer:
__builtin__.__import__ = log_import

import sys

Of course this is very primitive but I think you get the idea. Running the code at the beginning and it will log all your imports.

Pierre Thibault

Python Developer/Développeur Python
Montréal, QC