[enh] refactored pbp into mostly self-contained module, and main.py for scripts
[mod] refactored into setup.pyable structure