Faster module creation for Weboob

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’t stand anything repetitive, I created a tool to speed up module creation, which was inspired from the now retired tools/

Now, when I see code generation, 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.

It’s a very simple tool, which provides “recipes”, 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.

Here is an example session:

$ ./tools/
usage: [-h] [-a AUTHOR] [-e EMAIL] {base,comic,comic.test} ... error: too few arguments
$ ./tools/ base "foo bar"
Created modules/foobar/
Created modules/foobar/
Created modules/foobar/
Created modules/foobar/

The should look like:

# -*- coding: utf-8 -*-
# Copyright(C) 2013      Laurent Bachelier
# [...]
from import BaseBackend
from .browser import FooBarBrowser
__all__ = ['FooBarBackend']
class FooBarBackend(BaseBackend):
    NAME = 'foobar'
    DESCRIPTION = u'foobar website'
    MAINTAINER = u'Laurent Bachelier'
    EMAIL = ''
    VERSION = '0.f'
    BROWSER = FooBarBrowser

You can jump into the code right now!

As of now, there is only a minimal “base” recipe and the two “comic” recipes taken from the previous tool; however as is intended to be highly extensible and maintainable, I hope it will support more specialized recipes soon (for example, “newspaper” or “pastebin”). You know what to do.

This entry was posted in Python, Weboob. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>