filyb.info

mardi 2 septembre 2008

Et un second pour la route

J’ai écris un billet en août, v’là que j’en fais deux le 1er septembre. (Ah non, mince, on est déjà le deux.)

Ceci pour signaler (ça le mérite) que Gilles Fabio a ouvert un nouveau blog, qui roule grâce à Django avec une application qu’il a codé pour l’occasion, Cockatoo. Bref, ça promet d’être que du bon, jetez-vous sur le fil de syndication.

Et sinon… des photos de Normandie, ainsi que dans le carnet photos.

$ fortune
Le café est un breuvage qui fait dormir,
quand on n'en prend pas. 
	-+- Alphonse Allais -+-

Maintenant, il est temps d’aller écrire.

mercredi 9 juillet 2008

SoC 2008: Croquant 1.0

I'm proud to announce the release of Croquant 1.0!

This is the first release of Croquant, the set of MoinMoin plugins for an integration with Crunchy. Right now, Croquant consists in:

  • A parser to embed python code, with VLAM, to add interpreters, editors, doctests, etc in Crunchy
  • Three macros to add some forms and links in Crunchy
  • A MoinMoin theme, which looks like python.org and is designed to be used with Crunchy (by example, the edition link in Crunchy will open the edition page outside Crunchy). An option can force the theme to behave exactly like the one of the Python wiki

You can already download Croquant 1.0.

jeudi 26 juin 2008

Astuce python : de l'autocomplétion dans l'interpréteur

N'avez-vous jamais rêvé de pouvoir obtenir d'une simple tabulation la liste des méthodes d'une classe ? De ne pas avoir à réécrire cette variable au nom tellement explicite qu'il en est trop long ? Heureusement, il est possible d'activer une autocomplétion très efficace dans notre interpréteur préféré  ! (Comment ai-je pu passer à côté jusqu'à aujourd'hui ?)

Cette astuce se base sur l'utilisation de GNU readline, et ne fonctionne donc pas sous Microsoft Windows.

Pour la mettre en place, il suffit de créer un fichier, nommé par exemple ~/.pythonrc qui contiendra des commandes exécutées au démarrage de l'interpréteur (uniquement en mode interactif), et d'y insérer le contenu suivant (provenant de la documentation du module rlompleter) :

(edit : voici une version modifiée pour permettre en plus d'indenter le code avec quatre espaces, source en commentaire.)

try:
    import readline
except ImportError:
    print "Module readline not available."
else:
    import rlcompleter

    class TabCompleter(rlcompleter.Completer):
        """Completer that supports indenting"""
        def complete(self, text, state):
            if not text:
                return ('    ', None)[state]
            else:
                return rlcompleter.Completer.complete(self, text, state)
    readline.set_completer(TabCompleter().complete)
    readline.parse_and_bind("tab: complete")

Il faut ensuite expliquer à l'interpréteur python de lire ce fichier à son démarrage. Cela se fait en définissant la variable d'environnement PYTHONSTARTUP, par exemple en insérant dans le fichier ~/.bashrc la ligne suivante :

export PYTHONSTARTUP="$HOME/.pythonrc"

Relancez bash, ouvrez python, et appréciez !

mercredi 11 juin 2008

SoC 2008: the Croquant project

I'm proud to announce the birth of Croquant !

Croquant is a set of MoinMoin plugins (well... just one for the moment), and aims to allow the writing of Crunchy tutorials directly from the wiki.

From the Croquant website, you can the documentation (okay, it's just a ReadMe), and get the code, using svn.

And you can see Croquant in action, thanks to the screencast of André Roberge: Test Driven Learning (TDL) using Crunchy and MoinMoin.

lundi 26 mai 2008

SoC 2008 : Start of coding

Today is the time to start working on my Summer of Code project.

Crunchy use a special markup, the VLAM, integrated in the XHTML, to define where add a python interpreter, a text editor, etc.

The first step of my work is to find an elegant and wiki-like syntax to add VLAM-like attributes inside a wiki page. This syntax must no be misinterpreted by MoinMoin, and should match the VLAM to help further improvement in Crunchy be used directly in wiki pages.

See also:

- page 1 de 3