qooxdoo/qooxdoo — pull request #49 by miracle2k (2013-02-16 00:28:01+00:00)
Title: Move CLI implementation to the generator package.

I suggested this first as part of #30, and will now try to split up that patch into smaller parts.

thron7 voiced some concerns:

> Turning a frontend program into a module looks like bad design to me. I'm not clear about how you are using an imported generator.py in your own code. It would be helpful to see your use case of this (Should be added to the bugzilla bug).
> Rather than importing generator.py, you should write a dedicated frontend that replaces it in your environment. generator.py is rather short and easy to replace.

I would suggest that this is a common pattern in Python. Libraries as popular as Django use this approach. A huge number of libraries use setuptools' console_scripts functionality to install scripts, which does exactly this: it creates a wrapper that calls into the package.

Once your front-end program becomes complex enough to require splitting into multiple modules, it can't remain in a single script file anyway. I would further argue that this is already the case: the pylib/generator package and the generator.py script are already interrelated, sharing the same Console object for output etc.

I don't think that generator.py is easy to replace at all. The amounted logic in that file with respect to how the configuration file is put together and resolved is considerable. I'm bound to deviate from further changes on part of Qooxdoo here, and I would not be surprised if things would break at some point.

The thing is that we really don't want our own frontend. We would must like to pass a configuration file to the generator through memory.