Think about: module v function v class... * can you effectively have portable functions? def foo(...): import shlex # ... -or- @requires(shlex) def foo(...): # ... Idea: package from2to: - module2package - package2module # not always possible - function2module # requires import knowledge Issues: - what about a function that has its own exception type? e.g.:: def edit(): class EditException(Exception): """exceptions when editing""" Stick in globals()? You need to expose such that the exception can be caught (or there's no purpose in doing this). Links: - http://wheel.readthedocs.org/en/latest/