<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Penguin &#187; Weboob</title>
	<atom:link href="http://laurent.bachelier.name/category/weboob/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurent.bachelier.name</link>
	<description></description>
	<lastBuildDate>Wed, 15 May 2013 14:23:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Faster module creation for Weboob</title>
		<link>http://laurent.bachelier.name/2013/02/faster-module-creation-for-weboob/</link>
		<comments>http://laurent.bachelier.name/2013/02/faster-module-creation-for-weboob/#comments</comments>
		<pubDate>Thu, 14 Feb 2013 22:07:03 +0000</pubDate>
		<dc:creator>laurentb</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Weboob]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=447</guid>
		<description><![CDATA[From the start, creating a new weboob module was a pain, as you had a lot of repetitive copy-paste-alter tasks to do. Since I can&#8217;t stand anything repetitive, I created a tool to speed up module creation, which was inspired from the now retired tools/gen_comic_reader.sh. Now, when I see code generation, I usually think something [...]]]></description>
				<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:7b51d113f3fb989e8d8d1e200d5e40042c5cf263'><p>From the start, creating a new weboob module was a pain, as you had a lot of repetitive copy-paste-alter tasks to do.<br />
Since I can&#8217;t stand anything repetitive, I created a tool to speed up module creation, which was <a href="http://symlink.me/issues/700">inspired</a> from the now retired <code>tools/gen_comic_reader.sh</code>.</p>
<p>Now, when I see <a href="https://en.wikipedia.org/wiki/Boilerplate_code">code generation</a>, I usually think something must be wrong. In our case, what we are really doing is filling automatically some fields like author, class name, etc. A lot of web frameworks also do that kind of base code generation with success.</p>
<p>It&#8217;s a very simple tool, which provides &#8220;recipes&#8221;, those recipes being a set of templates. Though you can override them, it tries to guess as much details as possible, like your name and e-mail.</p>
<p>Here is an example session:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>boilerplate.py
usage: boilerplate.py <span style="color: #7a0874; font-weight: bold;">&#91;</span>-h<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>-a AUTHOR<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>-e EMAIL<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>base,comic,comic.test<span style="color: #7a0874; font-weight: bold;">&#125;</span> ...
boilerplate.py: error: too few arguments
&nbsp;
$ .<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>boilerplate.py base <span style="color: #ff0000;">&quot;foo bar&quot;</span>
Created modules<span style="color: #000000; font-weight: bold;">/</span>foobar<span style="color: #000000; font-weight: bold;">/</span>__init__.py
Created modules<span style="color: #000000; font-weight: bold;">/</span>foobar<span style="color: #000000; font-weight: bold;">/</span>backend.py
Created modules<span style="color: #000000; font-weight: bold;">/</span>foobar<span style="color: #000000; font-weight: bold;">/</span>browser.py
Created modules<span style="color: #000000; font-weight: bold;">/</span>foobar<span style="color: #000000; font-weight: bold;">/</span>pages.py</pre></td></tr></table></div>

<p>The <code>backend.py</code> should look like:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Copyright(C) 2013      Laurent Bachelier</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># [...]</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> weboob.<span style="color: black;">tools</span>.<span style="color: black;">backend</span> <span style="color: #ff7700;font-weight:bold;">import</span> BaseBackend
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> .<span style="color: black;">browser</span> <span style="color: #ff7700;font-weight:bold;">import</span> FooBarBrowser
&nbsp;
&nbsp;
__all__ <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'FooBarBackend'</span><span style="color: black;">&#93;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> FooBarBackend<span style="color: black;">&#40;</span>BaseBackend<span style="color: black;">&#41;</span>:
    NAME <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'foobar'</span>
    DESCRIPTION <span style="color: #66cc66;">=</span> u<span style="color: #483d8b;">'foobar website'</span>
    MAINTAINER <span style="color: #66cc66;">=</span> u<span style="color: #483d8b;">'Laurent Bachelier'</span>
    EMAIL <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'laurent@bachelier.name'</span>
    VERSION <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'0.f'</span>
&nbsp;
    BROWSER <span style="color: #66cc66;">=</span> FooBarBrowser</pre></td></tr></table></div>

<p>You can jump into the code right now!</p>
<p>As of now, there is only a minimal &#8220;base&#8221; recipe and the two &#8220;comic&#8221; recipes taken from the previous tool; however as <code>boilerplate.py</code> is intended to be highly extensible and maintainable, I hope it will support more specialized recipes soon (for example, &#8220;newspaper&#8221; or &#8220;pastebin&#8221;). <a href="http://symlink.me/projects/weboob/wiki/How_to_contribute">You know what to do.</a></p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2013/02/faster-module-creation-for-weboob/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New employer</title>
		<link>http://laurent.bachelier.name/2013/02/new-employer/</link>
		<comments>http://laurent.bachelier.name/2013/02/new-employer/#comments</comments>
		<pubDate>Sun, 10 Feb 2013 14:27:56 +0000</pubDate>
		<dc:creator>laurentb</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[Weboob]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=442</guid>
		<description><![CDATA[I am now working for Budget Insight. My work should be mostly Python, and for some part contributions to the weboob project. Even though I&#8217;m not looking at all in that branch, I still get at least an e-mail a week for symfony-related work! I guess this is good for Symfony developers, though.]]></description>
				<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:b2a68f8452745a495e5529ca3bbed5beab12e901'><p>I am now working for <a href="https://www.budget-insight.com/">Budget Insight</a>.</p>
<p>My work should be mostly Python, and for some part contributions to the <a href="http://weboob.org/">weboob</a> project.</p>
<p>Even though I&#8217;m not looking at all in that branch, I still get at least an e-mail a week for symfony-related work! I guess this is good for Symfony developers, though.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2013/02/new-employer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
