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/gen_comic_reader.sh.

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/boilerplate.py
usage: boilerplate.py [-h] [-a AUTHOR] [-e EMAIL] {base,comic,comic.test} ...
boilerplate.py: error: too few arguments
 
$ ./tools/boilerplate.py base "foo bar"
Created modules/foobar/__init__.py
Created modules/foobar/backend.py
Created modules/foobar/browser.py
Created modules/foobar/pages.py

The backend.py should look like:

# -*- coding: utf-8 -*-
 
# Copyright(C) 2013      Laurent Bachelier
#
# [...]
 
from weboob.tools.backend import BaseBackend
 
from .browser import FooBarBrowser
 
 
__all__ = ['FooBarBackend']
 
 
class FooBarBackend(BaseBackend):
    NAME = 'foobar'
    DESCRIPTION = u'foobar website'
    MAINTAINER = u'Laurent Bachelier'
    EMAIL = 'laurent@bachelier.name'
    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 boilerplate.py 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.

Posted in Python, Weboob | Leave a comment

New employer

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’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.

Posted in Meta, Weboob | Leave a comment

symfttpd 1.1.2 released, and its future

symfttpd 1.1.2 was released… 9 months ago.
It contains only minor fixes, and a nice feature for developers to force the expiration of static files (only with spawn, not genconf, of course).

You can download it here, at least until GitHub decides to be even more useless than it currently is and completely removes downloads. The homepage hasn’t moved and is still at GitHub.

This is probably the last 1.x release of symfttpd, and most probably the last release by me.

Since I started writing symfttpd, a lot of things changed. Symfony 2.0 was released, PHP 5.4 was released with a built-in server, and Symfony supports it.
Now, symfttpd is more than a simple built-in server, but my growing disinterest for symfony, especially Symfony2, did not motivate me to work on the multiapp branch, which was going to support both symfony versions and other projects like WordPress.

However, if you are interested by Symfony2, there is the built-in server solution, and an active fork by Benjamin Grandfond.
It’s a big departure from some of the original goals (simple code with no dependencies) but the usage of the Symfony2 libraries allows much better results than regular PHP. It is also packaged by composer, somewhat of an alternative to PEAR1.

If people are interested, here is a dump of features I wanted to implement:

  • WordPress support
  • SSL port support, with automatic certificate generation
  • Find the project root automatically, like git does
  • Check if port is free before starting the server
  • sudo support to use ports <1024 (lighttpd can become a normal user right after taking the port)
  • Sample files support
  1. both being crap []
Posted in PHP, Symfony | Leave a comment