Development testing without reinstalling egg constantly?

Grant Edwards grant.b.edwards at gmail.com
Thu Jun 29 10:03:42 EDT 2017


I've forked a copy of https://github.com/Roguelazer/muttdown and have
been adding a few features and fixing a few bugs.  It's meant to be
installed using setup tools, and then invoked via /usr/bin/muttdown
which looks like this:

   #!/usr/lib/python-exec/python2.7/python2
   # EASY-INSTALL-ENTRY-SCRIPT: 'muttdown==0.3','console_scripts','muttdown'
   __requires__ = 'muttdown==0.3'
   import re
   import sys
   from pkg_resources import load_entry_point
   
   if __name__ == '__main__':
       sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
       sys.exit(
           load_entry_point('muttdown==0.3', 'console_scripts', 'muttdown')()
       )

The projects 'main.py' can't be run directly from the command line,
since it contains code like this:

   from . import config
   from . import __version__
   __name__ = 'muttdown'
   
   [ stuff that does real work ]
   
   if __name__ == '__main__':
       main()

I've hacked up the main.py bits shown above to allow it to be run
directly in order to test changes without installing, but then I
always have to remember to change it back before committing a change.

This seems like the wrong way to do things, but I can't figure out
what the _right_ way is.  What's the Pythonic way to do deal with
this?
   
-- 
Grant Edwards               grant.b.edwards        Yow! How's the wife?
                                  at               Is she at home enjoying
                              gmail.com            capitalism?




More information about the Python-list mailing list