[Pyb-developer] Top level invoication questions
Status: Alpha
Brought to you by:
aeden
From: <an...@re...> - 2004-05-13 20:57:08
|
Hi Anthony and friends, I got distracted for a couple of weeks but am now trying hard to make Pyb work for packaging my code. Looks more and more promising. However I keep getting this "unpythonic" feeling at the very top level. (1) Thread questions: You run pyb.bat over a script, which has an execute-on-init object at the bottom. The only work pyb.bat does AFAICT is to start a thread and run the target module in it. Why is the thread important? (2) Executable scripts Assuming I can live without a thread, why not ditch it and just make an "executable script" the norm? Python scripts are always executable on windows. If I saw a directory containing things like this, I'd naturally think to execute them (especially if they start with a verb) download_dependents.py build_minimal_distro.py build_full_distro.py This feels like an Ant legacy. XML files cannot be executed so the command line tool is needed there. If I change the bottom of the script of my scripts to |if __name__=='__main__': | Project() then it all works. (3) avoid auto-running on import The above change also stops scripts from executing when I import into Pythonwin, or run one of a number of documentation tools over my source directory. (3) explicit run method I would prefer to have an explicit run e.g. |#project definition omitted |Project(name='Demo Project', default='build', targets=targets) |if __name__=='__main__': | Project.run() This opens the possibility to load up and examine PYB projects in analysis tools, make nice easy GUIs etc, simply by getting hold of the Project object and inspecting it. Otherwise parsers are needed. Any thoughts? Andy Robinson |