<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Ian Bicking: a blog</title>
	<link>http://blog.ianbicking.org</link>
	<description></description>
	<pubDate>Sun, 10 Aug 2008 19:15:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>Happy Birthday PotteryBlog</title>
		<link>http://blog.ianbicking.org/2008/08/10/happy-birthday-potteryblog/</link>
		<comments>http://blog.ianbicking.org/2008/08/10/happy-birthday-potteryblog/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 19:15:15 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Non-technical]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/08/10/happy-birthday-potteryblog/</guid>
		<description><![CDATA[
A happy 4th Birthday Emily&#8217;s Blog!

]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>A happy 4th Birthday <a class="reference external" href="http://potteryblog.com/2008/08/four-years-of-pottery-blog.html">Emily&#8217;s Blog</a>!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/08/10/happy-birthday-potteryblog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Doctest Wishlist</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/</link>
		<comments>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 04:11:11 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/</guid>
		<description><![CDATA[
Lately I&#8217;ve been doing most of my testing with doctest, primarily using stand-alone text files.  I generally like it (otherwise I wouldn&#8217;t be using it), but it does make me frustrated with doctest sometimes.  On my wishlist (roughly in order):


I wish output was always displayed, even when there&#8217;s an exception.  I see [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>Lately I&#8217;ve been doing most of my testing with <a class="reference external" href="http://python.org/doc/current/lib/module-doctest.html">doctest</a>, primarily using <a class="reference external" href="http://python.org/doc/current/lib/doctest-simple-testfile.html">stand-alone text files</a>.  I generally like it (otherwise I wouldn&#8217;t be using it), but it does make me frustrated with doctest sometimes.  On my wishlist (roughly in order):</p>
<ul>
<li>
<p class="first">I wish output was always displayed, even when there&#8217;s an exception.  I see no reason for the current behavior.  Really exceptions could be treated like any other output (if ELLIPSIS was on by default).</p>
</li>
<li>
<p class="first">I wish you could turn on options like ELLIPSIS from within a doctest, for all expressions.  (<tt class="docutils literal"><span class="pre">#</span> <span class="pre">doctest:</span> <span class="pre">+ELLIPSIS</span></tt> on every line is beyond ugly.)</p>
</li>
<li>
<p class="first"><tt class="docutils literal"><span class="pre">&lt;BLANKLINE&gt;</span></tt> is terribly ugly.</p>
</li>
<li>
<p class="first">There&#8217;s no way of saying &quot;I don&#8217;t care what this prints&quot;.  You can&#8217;t do:</p>
<pre class="literal-block">
&gt;&gt;&gt; some_function()
...
</pre>
<p>because the <tt class="docutils literal"><span class="pre">&#8230;</span></tt> is treated like a continuation.</p>
</li>
<li>
<p class="first">Plugging in an alternate output checker is kind of tedious, and can&#8217;t be done from within a doctest (without horrible hacks).</p>
</li>
<li>
<p class="first">I&#8217;d like to be able to easily jump into an interactive state from doctest.  Maybe <a class="reference external" href="http://python.org/doc/current/lib/module-pdb.html">pdb</a> can do this, but I&#8217;ve never figured that out exactly.</p>
</li>
<li>
<p class="first">Getting <a class="reference external" href="http://code.google.com/p/python-nose/">nose</a> to run <tt class="docutils literal"><span class="pre">.txt</span></tt> files as doctests is really hard, involving a combination of options I always forget.</p>
</li>
<li>
<p class="first">There&#8217;s no way to abort the doctest.  Sometimes I&#8217;d like to run some environment checks early on, and be able to stop the test if they fail.</p>
</li>
<li>
<p class="first">I wish it was easier to apply to non-Python code.  (I&#8217;ve adapted it via subclassing <a class="reference external" href="http://pylogo.org/">for Logo</a> but I wouldn&#8217;t do that often.)</p>
</li>
<li>
<p class="first">I wish I could copy and paste from doctests to consoles.  But I don&#8217;t see any solution to this problem.</p>
</li>
<li>
<p class="first">The <a class="reference external" href="http://python.org/doc/current/lib/doctest-unittest-api.html">integration</a> with <a class="reference external" href="http://python.org/doc/current/lib/module-unittest.html">unittest</a> is pretty hacky.  Not that I&#8217;ve used unittest in years.  But some other test frameworks build off this integration.</p>
</li>
<li>
<p class="first"><tt class="docutils literal"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">doctest</span> <span class="pre">sometest.txt</span></tt> doesn&#8217;t do what it should do.  Instead it runs doctest&#8217;s self-tests.</p>
</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making a proxy with WSGI and lxml</title>
		<link>http://blog.ianbicking.org/2008/07/30/making-a-proxy-with-wsgi-and-lxml/</link>
		<comments>http://blog.ianbicking.org/2008/07/30/making-a-proxy-with-wsgi-and-lxml/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 16:52:22 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/30/making-a-proxy-with-wsgi-and-lxml/</guid>
		<description><![CDATA[
You can use WSGI to make rewriting middleware; WebOb specifically makes it easy to write.  And that&#8217;s cool, but it&#8217;s more satisfying to use your middleware right away without having to think about writing applications that might live behind the middleware.
There&#8217;s two libraries I&#8217;ll describe here to make that possible: paste.proxy to send WSGI [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>You can use WSGI to make rewriting middleware; <a class="reference external" href="http://pythonpaste.org/webob/">WebOb</a> specifically makes it easy to write.  And that&#8217;s cool, but it&#8217;s more satisfying to use your middleware right away without having to think about writing applications that might live behind the middleware.</p>
<p>There&#8217;s two libraries I&#8217;ll describe here to make that possible: <a class="reference external" href="http://pythonpaste.org/modules/proxy.html#paste.proxy.Proxy">paste.proxy</a> to send WSGI requests out via HTTP, and <a class="reference external" href="http://codespeak.net/lxml/lxmlhtml.html">lxml.html</a> which lets you rewrite the HTML to fix up the links.</p>
<p>To start, we need some kind of middleware that at least is noticeable.  How about something to make a word jumble of the page?  We&#8217;ll use lxml as well:</p>
<pre class="literal-block">
from lxml import html
from random import shuffle

def jumble_words(doc):
    &quot;&quot;&quot;Mixes up the words in an HTML document (doesn't touch tags or attributes)&quot;&quot;&quot;
    doc = html.fromstring(doc)
    # .text_content() gives the text without tags or attributes,
    # .body is the &lt;body&gt; tag:
    words = doc.body.text_content().split()
    shuffle(words)
    for el in doc.body.iterdescendants():
        # The ElementTree model puts all text in .text and .tail on elements, so that's
        # what we mix up:
        el.text = random_words(el.text, words)
        el.tail = random_words(el.tail, words)
    return html.tostring(doc)

def random_words(text, words):
    &quot;&quot;&quot;Pulls some words from the list words, with the same number of words in
    the previous `text`&quot;&quot;&quot;
    # text can be None, so we need this test:
    if not text:
        return text
    word_count = len(text.split())
    try:
        return ' '.join(words.pop() for i in range(word_count))
    except IndexError:
        # This shouldn't happen, because we should have exactly
        # the right number of words, but just in case...
        return text

from webob import Request

class JumbleMiddleware(object):
    &quot;&quot;&quot;Middleware that jumbles the words of HTML responses
    &quot;&quot;&quot;
    # This __init__ and __call__ are the basic pattern for middleware:
    def __init__(self, app):
        self.app = app
    def __call__(self, environ, start_response):
        req = Request(environ)
        # We don't want 304 Not Modified responses, because we mix up the response
        # differently every time.  So we'll make sure all the headers that could call that
        # (If-Modified-Since, etc) are removed with .remove_conditional_headers():
        req.remove_conditional_headers()
        # This calls the application with the request, and then returns a response; this
        # is the typical pattern for response-modifying middleware using WebOb:
        resp = req.get_response(self.app)
        if resp.content_type == 'text/html':
            resp.body = jumble_words(resp.body)
        return resp(environ, start_response)
</pre>
<p>Well, you don&#8217;t really need to jumble up your <em>own</em> pages, right?  Much more fun to jumble other people&#8217;s pages.  Enter the proxy.  Here&#8217;s a basic proxy:</p>
<pre class="literal-block">
from paste.proxy import Proxy
# We use this to make sure we didn't mess up anything with JumbleMiddleware;
# the validator checks for many WSGI requirements:
from wsgiref.validate import validator
import sys

def main():
    proxy_url = sys.argv[1]
    app = JumbleMiddleware(
        Proxy(proxy_url))
    app = validator(app)
    from paste.httpserver import serve
    serve(app, 'localhost', 8080)

if __name__ == '__main__':
    main()
</pre>
<p>If you look at the <a class="reference external" href="http://svn.colorstudy.com/home/ianb/recipes/rewritingproxy.py">full source</a> the command-line is a bit fancier, but it&#8217;s all obvious stuff.</p>
<p>OK, so this will work, but the links will often be broken unless the server only gives relative links.  But you can rewrite the links using lxml&#8230;</p>
<pre class="literal-block">
import urlparse

class LinkRewriterMiddleware(object):
    &quot;&quot;&quot;Rewrites the response, assuming the HTML was generated as though based at
    `dest_href`, and needs to be rewritten for the incoming request&quot;&quot;&quot;

    # The normal __init__, __call__ pattern:
    def __init__(self, app, dest_href):
        self.app = app
        if dest_href.endswith('/'):
            dest_href = dest_href[:-1]
        self.dest_href = dest_href

    def __call__(self, environ, start_response):
        req = Request(environ)
        # .path_info (aka environ['PATH_INFO']) is the path of the request
        # (URL rewriting doesn't really have to care about query strings)
        dest_path = req.path_info
        dest_href = self.dest_href + dest_path
        # req.application_url is the base URL not including path_info or the query string:
        req_href = req.application_url
        def link_repl_func(link):
            link = urlparse.urljoin(dest_href, link)
            if not link.startswith(dest_href):
                # Not a local link
                return link
            new_url = req_href + '/' + link[len(dest_href):]
            return new_url
        resp = req.get_response(self.app)
        # This decodes any possible gzipped content:
        resp.decode_content()
        if (resp.status_int == 200
            and resp.content_type == 'text/html'):
            doc = html.fromstring(resp.body, base_url=dest_href)
            doc.rewrite_links(link_repl_func)
            resp.body = html.tostring(doc)
        # Redirects need their redirect locations rewritten:
        if resp.location:
            resp.location = link_repl_func(resp.location)
        return resp(environ, start_response)
</pre>
<p>Then we rewire the application:</p>
<pre class="literal-block">
app = JumbleMiddleware(
    LinkRewriterMiddleware(Proxy(proxy_url), proxy_url))
</pre>
<p>Now there&#8217;s a fun little proxy for you to play with.  You can see the code <a class="reference external" href="http://svn.colorstudy.com/home/ianb/recipes/rewritingproxy.py">here</a>.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/07/30/making-a-proxy-with-wsgi-and-lxml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Me In Berlin &#038; Amsterdam</title>
		<link>http://blog.ianbicking.org/2008/07/28/me-in-berlin-amsterdam/</link>
		<comments>http://blog.ianbicking.org/2008/07/28/me-in-berlin-amsterdam/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 16:22:32 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Non-technical]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/28/me-in-berlin-amsterdam/</guid>
		<description><![CDATA[
I&#8217;m going on vacation in a couple weeks to Berlin and Amsterdam, flying to Berlin on August 12, leaving from Amsterdam on August 27, and transitioning between the two sometime in between.  Things Emily and I should see or do?  Care to meet up?  On vacations my evenings tend to be underscheduled.

]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>I&#8217;m going on vacation in a couple weeks to Berlin and Amsterdam, flying to Berlin on August 12, leaving from Amsterdam on August 27, and transitioning between the two sometime in between.  Things <a class="reference external" href="http://potteryblog.com">Emily</a> and I should see or do?  Care to meet up?  On vacations my evenings tend to be underscheduled.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/07/28/me-in-berlin-amsterdam/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My Experience Writing a Build System</title>
		<link>http://blog.ianbicking.org/2008/06/19/my-experience-writing-a-build-system/</link>
		<comments>http://blog.ianbicking.org/2008/06/19/my-experience-writing-a-build-system/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 04:41:54 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/06/19/my-experience-writing-a-build-system/</guid>
		<description><![CDATA[
Lately there&#8217;s been some interest in build processes among various people &#8212; Vellum was announced a while back, Ben has been looking for a tool and looking at Fabric, and Kevin announced Paver.  At the same time zc.buildout is starting to gain some users outside of the Zope world, and I noticed Minitage as [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>Lately there&#8217;s been some interest in build processes among various people &#8212; <a class="reference external" href="http://www.zedshaw.com/projects/vellum/">Vellum</a> was announced a while back, <a class="reference external" href="http://groovie.org/2008/04/09/wheres-the-capistrano-knock-off-for-us-python-web-devs">Ben has been looking for a tool</a> and looking at <a class="reference external" href="https://savannah.nongnu.org/projects/fab/">Fabric</a>, and <a class="reference external" href="http://www.blueskyonmars.com/projects/paver/">Kevin announced Paver</a>.  At the same time <a class="reference external" href="http://pypi.python.org/pypi/zc.buildout">zc.buildout</a> is starting to gain some users outside of the Zope world, and I noticed <a class="reference external" href="http://www.minitage.org/doc/rst/">Minitage</a> as an abstraction on top of zc.buildout.</p>
<p>A while ago I started working on a build project for <a class="reference external" href="http://topp.openplans.org">Open Plans</a> called <a class="reference external" href="https://svn.openplans.org/svn/fassembler/trunk">fassembler</a>.  I think the result has been fairly successful and maintainable, and I thought I&#8217;d share some of my own reflections on that tool.</p>
<div class="section" id="update-what-we-were-trying-to-accomplish">
<h2><strong>Update:</strong> what we were trying to accomplish</h2>
<p>I didn&#8217;t make it clear in the post just what we were trying to do, and what this build system would accomplish.</p>
<p>Our site (<a class="reference external" href="http://openplans.org">openplans.org</a>) is made up of several separate servers with an HTML-rewriting proxy on the front end.  We have a Zope server running a custom application, Apache running WordPress MU, and some servers running Pylons or other Python web applications for portions of our site.  We needed a way to consistently reproduce this entire stack, all the pieces, plugged together so that the site would actually work.  Two equally important places where we had to reproduce the stack are for developer rigs and the production site.</p>
<p>Our code is primarily Python and we use a <em>lot</em> of libraries, developed both internally and externally.  Setting up the site is primarily a matter of installing the right libraries and configuration and setting up any databases (both a <a class="reference external" href="http://www.zope.org/Products/StandaloneZODB">ZODB</a> databases and several MySQL databases).  We use a few libraries written in C, but <a class="reference external" href="http://python.org/doc/current/lib/module-distutils.html">distutils</a> handles the compilation of those pretty transparently.</p>
<p>For this case we really don&#8217;t care about build tools that focus on compilation.  We don&#8217;t care about careful dependency tracking because we are compiling very little software.</p>
</div>
<div class="section" id="make-doesn-t-make-sense">
<h2>make doesn&#8217;t make sense</h2>
<p><strong>Update 2</strong>: If you think the make model makes lots of sense, read the preceding section &#8212; it makes sense for a different problem set than what we&#8217;re doing.</p>
<p>We initially had a system based on <a class="reference external" href="http://agendaless.com/Members/chrism/software/buildit">BuildIt</a>, which is kind of like <a class="reference external" href="http://en.wikipedia.org/wiki/Make_(software)">make</a> with Python as the control code.  It wasn&#8217;t really a good basis for our build tool, and I think it added a lot of confusion, compounded by the fact that we weren&#8217;t quite sure what we wanted our build to do.  Ultimately I think the make model of building doesn&#8217;t make sense.</p>
<p>The make model is based on the idea that you <strong>really</strong> want to save work.  So you detect changes and remake things only as necessary.  For compilation this might make sense, because you edit code and recompile a lot and it&#8217;s tedious to wait.  But we are building a website, and installing software, and none of that style of efficiency matters.  make-style detection of work to be done doesn&#8217;t even save any time.  But it does make the build more fragile (e.g., if you define a dependency incorrectly) and much harder to understand, and you constantly find yourself wiping the build and starting from scratch because you don&#8217;t trust the system.</p>
<p>The metaphor for the new build system was much simpler: do a list of things, top to bottom.  There&#8217;s no effort into detecting changes in the build, or changes in the settings, or anything else.</p>
</div>
<div class="section" id="do-things-carefully">
<h2>Do things carefully</h2>
<p>In the build system almost all actions go through the <a class="reference external" href="https://svn.openplans.org/svn/fassembler/trunk/fassembler/filemaker.py">filemaker</a> module.  This is <em>kind of</em> a file abstraction library.  But the goals are entirely different than convenience: the goal is transparency and safety.  In contrast Paver uses <a class="reference external" href="http://www.jorendorff.com/articles/python/path/">path.py</a> for convenience, but I&#8217;m not sure what the win would be if we used a model like that.</p>
<p><tt class="docutils literal"><span class="pre">filemaker</span></tt> itself is heavily tied to the framework that it&#8217;s written for, specifically user interaction and logging.  Most tasks just <em>do</em> things, and rely on filemaker to detect problems and ask the user questions.  For example, every time a file is written, it checks if the file exists, and if it has the same content.  If it exists with other content, it asks the user about what to do.  It doesn&#8217;t overwrites files without asking (at least by default).  I think this makes the tool more humane as the default behavior for a build is to be careful and transparent.  The build author has to go out of their way to make things difficult.</p>
<p>Many zc.buildout recipes will blithely overwrite all sorts of files which always made me very uncomfortable with the product.  It&#8217;s the <em>recipes</em> in zc.buildout which do this, not the buildout framework itself, but because buildout made overwriting the easy thing to do, and didn&#8217;t start with humane conventions or tools, this behavior is the norm.</p>
<p>What I think filemaker most accomplished was the ability to do file operations while also asserting the expected state of the system, and so makes build bugs noticeable earlier instead of getting a build process that finishes successfully but creates a buggy build, or having an exception show up far from where the error was originally introduced.</p>
<p>Also, because it won&#8217;t overwrite your work in progress this has saved the build from engendering deep feelings of hatred in cases when it might overwrite your work in progress.  It&#8217;s hard to detect this absence of hatred, but I know that I&#8217;ve felt it with other systems.</p>
</div>
<div class="section" id="update-a-corollary-ignore-no-errors">
<h2><strong>Update:</strong> a corollary: ignore no errors</h2>
<p>One question you might wonder about: why not a shell script?  We did prototype some things as shell scripts, but we&#8217;ve consistently moved to Python at some point, even things that seemed really trivial.  The problem with shell scripts is they have horribly bad behavior with respect to errors.  Ignoring errors is really really easy, noticing errors is really hard.</p>
<p>This is absolutely unacceptable for builds.  Builds must not ignore errors.  The build may mostly work despite an error.  It might be totally broken, but the error message is lost in all sorts of useless output.  The error message probably makes no sense.  The context is lost.  No suggestion is given to the user.</p>
<p>When builds work, that&#8217;s great.  Build <em>do not</em> always work.  They always fail sometimes, and some poor sucker (usually in some hot potato-like arrangement) has to figure out what went wrong.  You have to plan for these problems.</p>
<p>Everything in the build tries to be careful about errors.  All places where it is not, it is a bug.  The resolution isn&#8217;t to see something appear to work, but create a broken build, and say &quot;oh, you forgot to set X&quot;.  The resolution is to make sure when you forget to set X it gives you an error that tells you to set X.</p>
<p>This is one of the more important and more often ignored principles of a good build/deployment system.  Maybe it&#8217;s gotten better, but when I first used zc.buildout (<em>very</em> early in its development) the poor handling of errors was by far the biggest problem and it left me with a bad taste in my mouth.  easy_install and setuptools in general is also very flawed in this respect.</p>
</div>
<div class="section" id="log-interesting-things">
<h2>Log interesting things</h2>
<p>I tried to make a compromise between logging very verbosely, and being too quiet.  As a user, I want to see everything <em>interesting</em> and leave out everything <em>boring</em>.  Determining interesting and boring can be a bit difficult, but really just require some attention and tweaking.</p>
<p>To make it possible to visually parse the output of the tool I found both indentation and color to be very useful.  Indentation is used to represent subtasks, and color to make sections and warnings stand out.</p>
<p>The default verbosity setting is not to be completely quiet.  Silence is a Unix convention that just doesn&#8217;t work for build tools.  Silence gets you interactions like this:</p>
<pre class="literal-block">
$ build-something target-directory/
(much time passes)
Error: cannot write /home/ianb/builds/20080426/target-directory/products/AuxInput/auxinput/config/configuration.xml
</pre>
<p>Why did it want to write that file?  Why can&#8217;t it write that file?  Is the build buggy?  Did I misconfigure it?  Does the directory exist?</p>
<p>The typical way of handling this is either to run the build again with logging setup or otherwise make it more verbose, or to get in the habit of always running it verbose.</p>
</div>
<div class="section" id="mixing-code-and-configuration">
<h2>Mixing code and configuration</h2>
<p>BuildIt, which we were using before, had the ability to put variables in settings, and you could read an option from another section with something like <tt class="docutils literal"><span class="pre">${section/option}</span></tt>.  It was limited to simple (but recursive) variable substitution, and had some clever but very confusing rules that created a kind of inheritance.</p>
<p>I liked the ability to do substitution, but wasn&#8217;t happy with the compromise BuildIt made.  I wasted a <em>lot</em> of time trying to figure out the context of substitutions.  So, I saw two directions.  One was to remove the cleverness and just do simple substitution.  This is the choice zc.buildout made.  The other was to go whole-hog.  With a bit of trepidation I decided to to go for it, and I made the choice to treat all configuration settings as <a class="reference external" href="http://pythonpaste.org/tempita/">Tempita</a> templates.  All configuration is generally accessed via <tt class="docutils literal"><span class="pre">config.setting_name</span></tt>, and that lazily interpolates the setting (it took me quite a while to figure out how to avoid infinite loops of substitution).  Because evaluation is done lazily settings can depend on each other and be overridden and have lots of code in defaults (e.g., a default that is calculated based on the value of another setting), and it works out okay.  Most settings just ended up having a smart default, and as a result very little tweaking of the configuration is necessary.</p>
<p>Somewhat ironically the result was a kind of atrophying of the settings, because no one actually <em>set</em> them, instead we just tweaked the defaults to get it right.  Now I&#8217;m not entirely sure what exactly the &quot;settings&quot; are setting, or who they should really belong to.  To the build?  To the tasks?  While this is conceptually confusing, in practice it isn&#8217;t so bad.  This mixing of code and configuration has been distinctly useful, and not <em>nearly</em> as problematic to debug as I worried it would be.   In some ways it was a way of building <tt class="docutils literal"><span class="pre">lambda</span></tt> into every string, and the lazy evaluation of those strings has been really important.  But it&#8217;s not clear if they are really settings.</p>
<p>Would normal string interpolation have been enough (e.g., with <a class="reference external" href="http://python.org/doc/current/lib/node40.html">string.Template</a>)?  I&#8217;m pretty sure it wouldn&#8217;t have been.  The ability to do a little math or use functions that read things from the environment has been very important.</p>
</div>
<div class="section" id="managing-python-libraries">
<h2>Managing Python libraries</h2>
<p>fassembler uses <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> for building each piece of the stack.  Generally it creates several environments and installs things into them &#8212; it doesn&#8217;t run inside the environments itself.  This works fine.</p>
<p>zc.buildout in comparison does some fancy stuff to scripts where specific eggs are enabled when you run a script.  Each script has a list of <em>all</em> the eggs to enable.  You can&#8217;t install things or manage anything manually, even to test &#8212; you always have to go through buildout, and it will regenerate the scripts for you.  zc.buildout was implemented at the same time as workingenv (the predecessor to virtualenv), and I actually finished virtualenv with fassembler in mind, so I can&#8217;t blame zc.buildout for not using virtualenv.  That said, I don&#8217;t think the zc.buildout system makes any sense.  And it&#8217;s really complicated and has to access all sorts of not-really-public parts of easy_install to work.</p>
<p>Isolation is only the start.  easy_install makes sure each library&#8217;s claimed dependencies are satisfied.  You might then think easy_install would do all the work to make the stack work.  It is nowhere close to making the stack work.  <tt class="docutils literal"><span class="pre">setup.py</span></tt> files can/should contain the bare minimum that is known to be necessary to make a package work.  But they can&#8217;t predict future incompatibilities, and they can&#8217;t predict interactions.  And you don&#8217;t want all your packages changing versions arbitrarily.  If you work with a lot of libraries you <em>need</em> those libraries to be pinned, and only update them when you <em>want</em> to update them, not just because an update has been released.</p>
<p>So for each piece of the stack we have a set of &quot;requirements&quot;.  This is a flat files that indicates all the packages to install.  They can have explicit versions, far more restrictive than anything you should put in <tt class="docutils literal"><span class="pre">setup.py</span></tt>.  It also can check out from svn, including pinning to revisions.  This installation plan can go in svn, you can do diffs on it, you can branch and copy and do whatever.  Maybe at some point we could use it to keep cached copies of the libraries.  For now it mostly uses <tt class="docutils literal"><span class="pre">easy_install</span></tt> (and <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">develop</span></tt> for checkouts).</p>
<p>In parallel we have a command-line program for just installing packages using files like this, called <a class="reference external" href="https://svn.openplans.org/svn/PoachEggs/trunk">PoachEggs</a>.  I want to make this better, and have fassembler use it, but I mostly note it because it implements a feature that can &quot;freeze&quot; all your packages to a requirements file.  You take a working build and freeze its requirements, giving explicit (<tt class="docutils literal"><span class="pre">==</span></tt>) versions for packages, and pin all the svn checkouts to a revision, so that the frozen requirements file will install exactly the packages you know work.</p>
<p>An alternative to this is what the <a class="reference external" href="http://repoze.org/">Repoze</a> guys are doing, which is to create a custom index that only includes the versions of libraries that you want.  You then tell easy_install to use this instead of <a class="reference external" href="http://pypi.python.org/pypi">PyPI</a>.  It works with zc.buildout (and anything that uses easy_install), but I can&#8217;t get excited about it compared to a simple text file.  I also want svn checkouts instead of create tarballs of the checkout &#8212; I like an editable environment, because the build is just as much to support developers as to support deployment.</p>
</div>
<div class="section" id="the-structure">
<h2>The structure</h2>
<p>A big part of the development of fassembler was nailing down the structure of our site, and moving to use tools like <a class="reference external" href="http://supervisord.org/">supervisor</a> to manage our processes.  A lot of these expectations are built into the builds and fassembler itself.  This is part of what makes the build Work &#8212; the pieces all conform to a common structure with some basic standards.  But this isn&#8217;t the build tool itself, it&#8217;s just a set of conventions.</p>
<p>I don&#8217;t know quite what to make of this.  Extracting the conventions from the builds leads to a situation where you can more easily misconfigure things, and the installation process ends up being more documentation-based instead of code-based.  We do <em>not</em> want to rely on documentation, because documentation is generally because of a flaw in the build process that needs explaining.  It&#8217;s faster for everyone if the code is just right.  Maybe these conventions could be put into code, separate from the build.  The abstraction worries me, though &#8212; too much to keep track of?</p>
</div>
<div class="section" id="what-we-don-t-get-right">
<h2>What we don&#8217;t get right</h2>
<p>The biggest problem is that fassembler is our own system and no one else uses it.  If someone wants to use just a piece of our stack they either have to build it manually or they have to use our system which is meant to build all our pieces together with our conventions.  There&#8217;s some pressure to use zc.buildout to make pieces more accessible to other Zope users.  We&#8217;ve also found things that build with zc.buildout that we&#8217;d like to use (e.g., setups for <a class="reference external" href="http://varnish.projects.linpro.no/">varnish</a>).</p>
<p>We haven&#8217;t figured out how to separate the code for building <em>our</em> stuff from the build software itself.  There&#8217;s a bootstrapping problem: you need to get the build code to build a project, and so it can&#8217;t be part of the project you are building.  zc.buildout uses configuration files (that aren&#8217;t code, so they lack the bootstrap problem) and it uses <a class="reference external" href="http://pypi.python.org/pypi/zc.buildout#id1">recipes</a> (a kind of plugin) and has gone to quite a bit of effort to bootstrap everything.  virtualenv also supports a kind of <a class="reference external" href="http://pypi.python.org/pypi/virtualenv#bootstrap-example">bootstrap</a> which we use to do the initial setup of the environment, but it doesn&#8217;t support code organization in the style of zc.buildout.</p>
<p>Builds are also fairly tedious to write.  They aren&#8217;t horrible, but they feel much longer than they should be.  Part of their length, though, is that over time we put in more code to guard against environment differences or build errors, and more code to detect the environment.  But compared to zc.buildout&#8217;s configuration files, it doesn&#8217;t feel quite as nice, and if it&#8217;s not as nice sometimes people are lazy and do ad hoc setups.</p>
</div>
<div class="section" id="the-future">
<h2>The future</h2>
<p>We haven&#8217;t really decided, but as you might have noticed zc.buildout gets a lot of attention here.  There&#8217;s quite a few things I don&#8217;t like about it, but a lot of these have to do with the recipes available.  We don&#8217;t <em>have</em> to use the standard zc.buildout egg installation recipe.  In fact that would be first on the chopping block, replaced with something much simpler that assumes you are running inside a virtualenv environment, and probably something that uses requirement files.</p>
<p>Also, we could extract filemaker into a library and recipes could use that.  Possibly logging could be handled the same way (the <a class="reference external" href="http://python.org/doc/current/lib/module-logging.html">logging</a> module just isn&#8217;t designed for an interactive experience like a build tool).  Then if we used other people&#8217;s recipes we might feel grumpy, since they&#8217;d use neither filemaker or our logging, but it would still work.  And our recipes would be full of awesome.  The one thing I don&#8217;t think we could do is introduce the template-based configuration.  Or, if we did, it would be hard.</p>
<p>That said, there is a very different direction we could go, one inspired more by <a class="reference external" href="http://code.google.com/appengine/">App Engine</a>.  In that model we build files under a directory, and that directory is the build.  Wherever you build, you get the same files, period.  All paths would be relative.  All environmental detection would happen in code at runtime.  Things that aren&#8217;t &quot;files&quot; exactly would simply be standard scripts.  E.g., database setup would not be done by the build, but would be a script put in a standard location.</p>
<p>This second file-based model of building is very much different than the principles behind zc.buildout.  zc.buildout requires rebuilding when anything changes, and does so without apology.  It requires rebuilding to move the directories, or to move to different machines.  Using a file-based model requires a lot of push-back into the products themselves.  Applications have to be patched to accept smart relative paths.  They have to manage themselves a lot more, detect their environment, handle any conflicts or ambiguities, being graceful about stuff like databases, because the files have to be universal.  In an extreme case I could imagine going so far as to only keep a template for a configuration file, and write the real configuration file to a temporary location before starting a server (if the server cannot be patched to accept runtime location information).</p>
<p>So this is the choice ahead.  I&#8217;m not sure <em>when</em> we&#8217;ll make this choice (if ever!) &#8212; build systems are dull and somewhat annoying, but they are no more dull and annoying than dealing with a poor build system.  Actually, they are <em>definitely</em> less dull than working with a build system that isn&#8217;t good enough or powerful enough, or one that simply lacks the TLC necessary to keep builds working.  So no choice is a choice too, and maybe a bad choice.</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/06/19/my-experience-writing-a-build-system/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thoughts About the Erlang Runtime</title>
		<link>http://blog.ianbicking.org/2008/06/09/thoughts-about-the-erlang-runtime/</link>
		<comments>http://blog.ianbicking.org/2008/06/09/thoughts-about-the-erlang-runtime/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 00:03:21 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Erlang]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/06/09/thoughts-about-the-erlang-runtime/</guid>
		<description><![CDATA[
I should preface this entire post by noting that I haven&#8217;t used Erlang, just read about it, and I handle most concurrency using Python threads, a model for which I have no great affection (or hate).  But I was reading two posts by Patrick Logan on Erlang and it got me thinking again.
From my [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>I should preface this entire post by noting that I haven&#8217;t used Erlang, just read about it, and I handle most concurrency using Python threads, a model for which I have no great affection (or hate).  But I was reading <a class="reference external" href="http://patricklogan.blogspot.com/2008/05/toward-finer-tuning-of-definitions-of.html">two</a> <a class="reference external" href="http://patricklogan.blogspot.com/2008/05/this-is-part-two-of-my-response-to-ted.html">posts</a> by Patrick Logan on Erlang and it got me thinking again.</p>
<p>From my reading and what I&#8217;ve heard from other people, Erlang the language-and-syntax seems quite crufty.  Erlang is not the Complete Package, the language that will make you leave your wife, the language that will have you walking into telephone polls because it&#8217;s just so <em>hot</em> that you can&#8217;t take your eyes off it.  Erlang is not that language.  People seem to get excited about two things in Erlang: the concurrency model and pattern matching.  I&#8217;m not quite sure why people are excited about pattern matching.  <a class="reference external" href="http://svn.colorstudy.com/home/ianb/recipes/patmatch.py">Pattern matching isn&#8217;t particularly hard to implement</a>, though maybe it interacts with other aspects of the system in a way I don&#8217;t understand.  I remain skeptical that it&#8217;s anything special.</p>
<p>Then there is the concurrency model (and its associated message passing), and this <em>does</em> strike me as special.  You can <a class="reference external" href="http://candygram.sourceforge.net/">kind of</a> implement that model in Python, but with none of the concrete benefits.</p>
<p>These are the useful features I see in the concurrency model:</p>
<ol class="arabic simple">
<li>Erlang processes are share-nothing.</li>
<li>The processes are light weight.  You can start lots of processes, and they start quickly and can die off quickly without any great overhead.  They aren&#8217;t OS-level processes.  These are sometimes called green processes or microprocesses.  There are many implementations of micro<em>threads</em> in Python, but you lose the benefits of share-nothing.</li>
<li>The runtime makes light weight processes feasible as well.  The OS overhead of a Python process is actually just a small part of the total overhead when spawning a process.  Loading and initializing the runtime libraries of a Python program of even modest complexity is problematic.  I&#8217;m not sure exactly how Erlang does this, but I suspect it&#8217;s because libraries can be safely shared because Erlang is a functional language.  (<a class="reference external" href="http://blog.ianbicking.org/2008/01/12/what-php-deployment-gets-right/">PHP is also like this</a>, with most of the library written in a sharable C library.)</li>
</ol>
<p>1 and 2 can be handled with the right VM.  This isn&#8217;t a particularly <em>common</em> VM design, but it&#8217;s certainly doable.  3 is tricky, and effects the language design.</p>
<p>I don&#8217;t think it effects the language design as greatly as to require a functional language.  It requires that sharable code itself be a functional (i.e., immutable) subset of the language.  What the code <em>does</em> doesn&#8217;t have to be functional, only what the code <em>is</em>.</p>
<p>To explain this, functions in most languages are immutable.  Python functions aren&#8217;t actually immutable, but they are close enough that hardly anyone would notice if you made them immutable (right now you can overwrite their name, compiled code, and some other stuff &#8212; but almost no one actually does this).  The function may have side effects, but as long as the function <em>object</em> is immutable then it can be shared safely among processes.</p>
<p>You can extend this to the module as a whole.  This means you couldn&#8217;t <a class="reference external" href="http://en.wikipedia.org/wiki/Monkey_patch">monkeypatch</a> objects in the module, and module-level assignments would effectively be constants.  Any module-level objects would have to be immutable.  Things like classes, which are also a kind of module-level object, would also have to be immutable &#8212; meaning things like class variables would be immutable.  It could still be possible to do module-level code if there was a way of freezing the module after its instantiation (this would be important for Python, as even decorators are a kind of code run at import time).  Adding a general concept of &quot;freezing&quot; to the language might be the most general and expedient way to make modules sharable.</p>
<p>The other half of the concurrency model in Erlang is message passing.  Erlang processes send messages around like other systems send methods.  It would be possible to use exactly Erlang&#8217;s system, as it&#8217;s not Erlang-specific and has been ported to many languages.  Though I&#8217;d be somewhat more inclined to use <a class="reference external" href="http://en.wikipedia.org/wiki/Bencode">bencode</a> as it has some cleverness in its design.  Or perhaps JSON, just because.  Regardless of the format you are always passing around <em>data</em>, which I think is important.  Systems that pass around &quot;objects&quot; become complex, mostly because you just <strong>cannot</strong> pass objects around and so those systems are just complex facades built around data exchange.</p>
<p>Lately I&#8217;ve become fond of thinking of objects as views over a more fundamental data structure (<a class="reference external" href="http://pythonpaste.org/webob/">WebOb</a> is strictly based on this pattern).  Methods are details of the implementation, but only the data can mean something to someone else.  At least this is the worldview you start to internalize when you think about REST a lot.  (My post <a class="reference external" href="http://blog.ianbicking.org/2008/01/15/documents-vs-objects/">Documents vs. Objects</a> is also about this.)</p>
<p>Arguable a plain-data-with-views world is just the <a class="reference external" href="http://blog.ianbicking.org/because-unanswered-problems-are-always-hard.html">dynamic-weak-typed</a> anti-pattern.  That anti-pattern is one where you get all the disadvantages of dynamic typing, and all the disadvantages of static typing, all in one ugly bundle.  Erlang&#8217;s records remind me of this anti-pattern.  Instead of dictionaries everything is a tuple, and getting a record is just syntactic sugar mapping record names to indexes &#8212; all in the context of a dynamically typed language where you could mistype a value and get strange output as a result.</p>
<p>The strong-static typing solution to the type problem involves complicated contracts, aka &quot;service descriptions&quot;, the stuff of WS-*, CORBA IDL, etc.  The strong-dynamic typing solution is that every object have an explicit type.  This is fine for things we all agree on: lists, dictionaries, bytes, numbers.  Sadly even a basic thing like unicode strings cause problems, as do dates, but at least those have straight-forward solutions (you add more basic types to the message format).  More complex types, like a domain object (e.g., a user record) are difficult.  Are they all just dictionaries?  Dictionaries plus special metadata?  XML namespaces address this problem in some ways, but are also the point at which XML starts to just piss people off and make them want to use JSON.  And for good reason, because XML namespaces force you to define entities and responsible parties very early on, possibly long before you know what you are actually trying to do.  Besides XML, are there other systems that aren&#8217;t just naive/unextendable (bencode, JSON) and are still basically dynamically typed?</p>
<p>This is the kind of thing I would really love to see <a class="reference external" href="http://codespeak.net/pypy/">PyPy</a> experiment with.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/06/09/thoughts-about-the-erlang-runtime/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Which way?</title>
		<link>http://blog.ianbicking.org/2008/06/08/which-way/</link>
		<comments>http://blog.ianbicking.org/2008/06/08/which-way/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 01:26:04 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Non-technical]]></category>

		<category><![CDATA[Politics]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/06/08/which-way/</guid>
		<description><![CDATA[
Do you believe the world is (a) getting better, or (b) getting worse?
Please explain.  Please, no more &#34;both/neither&#34; answers: choose just one

]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>Do you believe the world is (a) getting better, or (b) getting worse?</p>
<p>Please explain.  <strong>Please, no more &quot;both/neither&quot; answers: choose just one</strong></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/06/08/which-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>pdb in the browser</title>
		<link>http://blog.ianbicking.org/2008/05/16/pdb-in-the-browser/</link>
		<comments>http://blog.ianbicking.org/2008/05/16/pdb-in-the-browser/#comments</comments>
		<pubDate>Fri, 16 May 2008 18:03:22 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/05/16/pdb-in-the-browser/</guid>
		<description><![CDATA[
People have asked me a few times about evalexception and pdb &#8212; they&#8217;d like to be able to use something like pdb through the browser, stepping through code.
The technique I used for tracebacks wouldn&#8217;t really work for pdb.  For a traceback I saved all the information from the frames &#8212; mostly just the local [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>People have asked me a few times about <a class="reference external" href="http://blog.ianbicking.org/ajaxy-exception-catching.html">evalexception</a> and <a class="reference external" href="http://python.org/doc/current/lib/module-pdb.html">pdb</a> &#8212; they&#8217;d like to be able to use something like pdb through the browser, stepping through code.</p>
<p>The technique I used for tracebacks wouldn&#8217;t really work for pdb.  For a traceback I saved all the information from the frames &#8212; mostly just the local variables &#8212; and then let the user interact with that through the browser.  But with pdb you pause the application part way through waiting for user input, and the routine only completes much later.</p>
<p>While writing <a class="reference external" href="http://pythonpaste.org/waitforit/">WaitForIt</a> I played around with techniques to deal with very slow WSGI applications.  Not that hard, really &#8212; you launch every request in a new thread, and you manage those requests in an application of its own.  So I started thinking about pdb again, and it started seeming feasible.  Whenever the app reads from stdin it goes into an interactive mode, showing you what comes out on stdout and letting you add input to stdin.  It&#8217;s nothing specific to pdb really.</p>
<p>So, with a bit of hacking, I added it into <a class="reference external" href="http://pypi.python.org/pypi/WebError/">WebError</a> (which is an extraction of the exception handling in <a class="reference external" href="http://pythonpaste.org">Paste</a>).  To give the demo a try, do:</p>
<pre class="literal-block">
hg clone http://knowledgetap.com/hg/weberror/
cd weberror
python setup.py develop
# You need Paste trunk:
easy_install Paste==dev
python weberror/pdbcapture.py
</pre>
<p>What you&#8217;ll see is not polished, it&#8217;s just working, but since I mostly did it to see if I could do it, that&#8217;s good enough for me.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/05/16/pdb-in-the-browser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The GPL and Principles</title>
		<link>http://blog.ianbicking.org/2008/05/06/the-gpl-and-principles/</link>
		<comments>http://blog.ianbicking.org/2008/05/06/the-gpl-and-principles/#comments</comments>
		<pubDate>Tue, 06 May 2008 18:08:14 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Politics]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/05/06/the-gpl-and-principles/</guid>
		<description><![CDATA[
For the most part by the time I finished writing my last article on licensing I had mostly convinced myself that the GPL isn&#8217;t a practical license for most projects.  That is, outcomes when using the GPL aren&#8217;t likely to be any better than outcomes using a permissive license, except for certain kinds of [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>For the most part by the time I finished writing my <a class="reference external" href="http://blog.ianbicking.org/2008/05/05/choosing-a-license/">last article on licensing</a> I had mostly convinced myself that the GPL isn&#8217;t a practical license for most projects.  That is, outcomes when using the GPL aren&#8217;t likely to be any better than outcomes using a permissive license, except for certain kinds of projects, mostly projects involving big faceless companies, and I&#8217;d just as soon avoid such projects anyway.</p>
<p>My own thinking on this has changed over the years in part because of a greater sense of humility about what I produce.  I&#8217;m really not that worried about people stealing my work because I don&#8217;t think that theft would be of much value.  But also because I realize that the value in software is not so much in the code as in the process.  The process is what is valuable, particularly for open source, and licensing doesn&#8217;t really address issues of process.</p>
<p>As an example, if I&#8217;m uncomfortable with how some member of an open source community is using the code, or the community, I will be much more effective by dealing with that head-on, talking with that member, or even confronting them if it&#8217;s really necessary.  If you give someone an unwelcoming attitude, they&#8217;ll probably go away.  The license doesn&#8217;t need to be your gatekeeper.  It&#8217;s not a particularly effective gatekeeper anyway.</p>
<p>Another change is perhaps a more reasonable valuation of code.  There was a time when people wanted to protect their intellectual property.  Even some non-software company might have gotten the idea that it should own the code it contracts someone else to write, under a proprietary license, so they could sell that software later.  That anyone would care to buy it was always an illusion, but the illusion is a little more obvious these days.</p>
<p>One value of the <a class="reference external" href="http://www.gnu.org/licenses/gpl.html">GPL</a> that I do want to acknowledge is its expression of <em>values</em>.  It makes this explicit:</p>
<blockquote>
<p>When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.</p>
<p>To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.</p>
</blockquote>
<p>But the GPL does more than just its text: adopting the GPL is a statement of principle on the part of the original authors, of the people who adopt the project, and of the people who later help maintain the project.  It is a statement that freedom is valued and that it is valued in a universal sense, not just in a personal or isolated sense.</p>
<p>This is implicit, not explicit, in the choice of license, but despite that I see this pattern in projects.  Projects that choose the GPL are more likely to engender a spirit of openness and sharing.  Not of the core project itself &#8212; both GPL and permissively licensed projects accomplish this just fine so long as they are properly maintained, and their success is far more related to how the project is managed than the licensing.  But I see the difference in the sofware that grows up around the project: extensions, complementary projects, documentation.</p>
<p>Maybe this is because of licensing.  The license filters the community, and the people who are left in a GPL project are all at least open to sharing.  But more than that, I think it puts people in the right state of mind to share.  The project feels more principled, the participation is based less on pragmatism and more on optimism.  And there&#8217;s always people coming into open source who haven&#8217;t really figured out why or what they want to get out of it.  Presenting them with the principles of Free Software influences their decision.  (This issue has <a class="reference external" href="http://www.gnu.org/philosophy/open-source-misses-the-point.html">caused some debate about terminology</a>.)</p>
<p>With all that said, you don&#8217;t need the GPL to present the principles of a project.  It&#8217;s certainly the easiest way to do so.  The GPL is shorthand for a rich set of principles and ideals.  But it&#8217;s shorthand for people who are already in the know.  The ideas need to be reiterated and explained and reconsidered to stay relevant.  I think a project might do more good with an explicit statement of principles.  With that in place the licensing might not matter so much.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/05/06/the-gpl-and-principles/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Governance</title>
		<link>http://blog.ianbicking.org/2008/05/05/governance/</link>
		<comments>http://blog.ianbicking.org/2008/05/05/governance/#comments</comments>
		<pubDate>Tue, 06 May 2008 04:08:30 +0000</pubDate>
		<dc:creator>Ian Bicking</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[Politics]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.ianbicking.org/2008/05/05/governance/</guid>
		<description><![CDATA[
It occurred to me&#8230; Django is something like a dictatorship&#8230; or maybe an oligarchy.  At first it seems like Pylons is the same&#8230; but no.  Pylons is clearly feudal.  I lord over Paste, WebOb, FormEncode.  Mike Bayer lords over Mako and SQLAlchemy.  Ben lords over Routes, Beaker, and Pylons.
I suppose [...]]]></description>
			<content:encoded><![CDATA[<div class="document">
<p>It occurred to me&#8230; Django is something like a dictatorship&#8230; or maybe an <a class="reference external" href="http://en.wikipedia.org/wiki/Oligarchy">oligarchy</a>.  At first it seems like Pylons is the same&#8230; but no.  Pylons is clearly <a class="reference external" href="http://en.wikipedia.org/wiki/Feudalism">feudal</a>.  I lord over Paste, WebOb, FormEncode.  Mike Bayer lords over Mako and SQLAlchemy.  Ben lords over Routes, Beaker, and Pylons.</p>
<p>I suppose in all cases there is a certain amount of democracy, because there are no <a class="reference external" href="http://en.wikipedia.org/wiki/Serf">serfs</a>, and any individual is free to travel to any kingdom they like.  Well, at least among the open source kingdoms.  Without citizenship, and with no exclusiveness of ownership, with even property having largely disappeared, I suppose it&#8217;s inevitable that traditional metaphors of control and governance don&#8217;t really make sense.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbicking.org/2008/05/05/governance/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
