Programmatically editing Python source
<p>This is something that I think would be very useful.  Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention.  There are a couple of things I would like to do with this:</p>

<ol>
<li><p>Edit the configuration of Python apps that use source modules for configuration.</p></li>
<li><p>Set up a "template" so that I can customize a Python source file on the fly.  This way, I can set up a "project" system on an open source app I'm working on and allow certain files to be customized.</p></li>
</ol>

<p>I could probably write something that can do this myself, but I can see that opening up a lot of "devil's in the details" type issues.  Are there any ways to do this currently, or am I just going to have to bite the bullet and implement it myself?</p>

<p>Python's standard library provides pretty good facilities for working with Python source; note the <a href="https://docs.python.org/2/library/tokenize.html" rel="nofollow">tokenize</a> and <a href="https://docs.python.org/2/library/parser.html" rel="nofollow">parser</a> modules.</p>
