[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] SGC 0.1.4 Released



Hey,

good points about not including.  I can see how the size could get quite large.  The smaller the better!

By realtive imports, I mean so people can do:
    python scg/examples/helloworld.py

Or:
    cd scg/examples/
    python helloworld.py

At the moment, newbies trying it out will just get a failure.

Including the tests, and examples also makes testing easier.  No matter how they have installed it, you can ask people to do:
    python -m scg.tests

Often people will install by pip or something, and not have the source.  Which means the examples won't be installed, and they will give up.
    python -m scg.examples.helloworld

You can also get tests to run on remote hosts easily as part of the install process.  For example, when pypm (and other bots) grab packages from pypi, the run the setup code, which you can get to run tests.  That way you get a bunch of remote testing hosts for free.

Doesn't really matter either way I guess.  Each way has upsides, and downsides... just some ideas.


cheers,



On Mon, Jun 11, 2012 at 4:55 AM, Mike C. Fletcher <mcfletch@xxxxxxxxxxxxx> wrote:
On 12-06-10 03:28 AM, René Dudfield wrote:
Great!

I like how you have  integrated the GUI events with a normal pygame event loop: http://program.sambull.org/sgc/tutorial.events.html

For example, a quit button could work like the following:
if  e.type == QUIT or (e.type  ==  GUI  ande.widget == quit_button):


    raise SystemExit()

Could the tutorials be based on examples?  Then people can run the example, and learn that way as well.
I believe one of them is already (the helloworld.py tutorial).  Making all of the tutorials example code does sound like a good idea.

You might want to consider putting the examples in sgc.examples with relative imports, so they are easier to run.  Likewise, consider adding your unit tests into somewhere like sgc.tests.
Keep in mind, that then the user of the library needs to *delete* them from the library when they copy the library into their game (or have extra code and data-files in their project).  (Sam moved the examples *out* at my suggestion, actually). If the examples get beyond a few trivial files (which I'm hoping they will, as they begin to show how to use custom images and the like), then that may be a non-trivial size.  Similar issue for the unit tests; if there are enough to be worthwhile they'll be a non-trivial amount of code, likely with quite a few data-fixtures.

As for relative imports; I'm not sure I follow the logic there.  If sgc is on the path (either because you ran setup.py install/develop or because you are in the root source-code directory), then the examples should all run.  If it's not, then a relative import doesn't, AFAIK, work (that is, from .. import X will just report "Attempted relative import in a non-package")?

Anyway, just my thoughts,
Mike

--
________________________________________________
 Mike C. Fletcher
 Designer, VR Plumber, Coder
 http://www.vrplumber.com
 http://blog.vrplumber.com