Detecting real python (perl/ruby/.so/...) dependencies

Andrew Pantyukhin infofarmer at
Tue Dec 19 07:16:39 PST 2006

It's never clear what a program really needs. Ports
solve this problem (mostly), but whenever you make
an update or port something new, you face the same

Developers tend to maintain a list of dependencies,
but you're in big luck if you find it up-to-date
and accurate. It would be nice to verify anyway.

So I need to find out what modules does a particu-
lar python program require. I can grep for import,
but many modules are present in our python bundle.
Is there a way to see:

1) Which of the modules are present, and any single
file for each of them, so we can map to installed

2) Which of the modules are not present

Ideally, also

3) A hint as to where can I find a missing module,
maybe from some CPAN-like repo

4) Whether the module is critical for the app, e.g.
whether it's imported inside a try block

I've seen something like this for Perl, but not
for Python apps. If you successfully use an automa-
ted way of detecting dependencies for Python (and
maybe other languages like Perl, Tcl/Tk, Ruby, or
maybe even C/C++, based on headers or something),
please share.


More information about the freebsd-ports mailing list