Python preprocessing imports

Posted by FiloSottile on Stack Overflow See other posts from Stack Overflow or by FiloSottile
Published on 2012-03-24T10:56:03Z Indexed on 2012/03/24 11:30 UTC
Read the original article Hit count: 195

Filed under:

I am managing a quite large python code base (>2000 lines) that I want anyway to be available as a single runnable python script. So I am searching for a method or a tool to merge a development folder, made of different python files into a single running script.

The thing/method I am searching for should take code split into different files, maybe with a starting __init___.py file that contains the imports and merge it into a single, big script.

Much like a preprocessor. Best if a near-native way, better if I can anyway run from the dev folder.

I have already checked out pypp and pypreprocessor but they don't seem to take the point.

Something like a strange use of __import__() or maybe a bunch of from foo import * replaced by the preprocessor with the code? Obviously I only want to merge my directory and not common libraries.

© Stack Overflow or respective owner

Related posts about python