Hi people, I'm really happy to announce the first public version of
Underscode, a Python identifier-like encoding. I took it mainly as a
hobby so its development in time has been very irregular, but I think
it's already time to release and enjoy it! Now the announcement text:
A Python identifier-like encoding
:Author: `Ivan Vilata i Balaguer <ivan(a)selidor.net>`__
Underscode_ is an encoding which is capable of representing *any*
Unicode string as a valid (and quite similar) Python identifier. The
way Unicode strings are encoded minimises the chances of clashing with
other existing names, while not obscuring the resulting string too much.
Some method decorators are provided which allow arbitrary objects to be
accessed as normal instance attributes, with optional tab-completion
support for interactive usage. The standard Python codec API is also
Underscode-encoded (or *underscoded*) strings can be quickly spotted
because they end with an *odd* number of underscores, and they contain
escape sequences beginning with an underscore where characters not
allowed in identifiers would be found. Some examples of underscoded
* ``_`` encodes the empty string.
* ``foo_`` encodes ``foo``.
* ``class_`` encodes ``class``.
* ``foo__bar_`` encodes ``foo_bar``.
* ``foo_x20bar_`` encodes ``foo bar``.
* ``_2006_09_18_``, like ``_20060918_``, encodes ``20060918``.
* ``_x2fbin_x2fls_``, encodes ``/bin/ls``.
* ``The_x20Knights_x20Who_x20Say_x20_u201cNi_x21_u201d_`` encodes the
properly quoted ``The Knights Who Say “Ni!”``.
* And the very flat ``____init_____`` which happens to be ``__init__``.
As you see, underscoded strings are quite similar to their decoded
counterparts when these are more or less identifier-like, but complex
strings can still be handled.
Underscode is a very basic tool which may have several uses:
* Avoiding clashes between method names and table field names in ORMs.
* Enabling interactive attribute-like completion for children in
hierarchically arranged structures (DOM trees, filesystems...), with
full Unicode support.
* As an aid in the generation of RPC stubs for identifiers which are not
allowed by Python.
* Computing unique IDs for sections in automatically generated XML or
* Naming page handlers for web server frameworks like CherryPy.
* ... just use your imagination!
The Underscode package is released under the GNU Lesser General Public
License (LGPL) version 3 or later (see http://www.gnu.org/licenses/).
Underscoded strings as attributes
Underscode provides a module with decorators that allow you to use plain
attribute access as a flexible way of accessing all kinds of "child
objects" without polluting the normal attribute namespace, and with
optional interactive completion if you wish so. For instance, you can
make the (string) keys of a dictionary accessible as attributes::
from underscode.decorators import proxy_method
def __getattr__(self, name):
return super(AttributedDict, self).__getattr__(name)
def __setattr__(self, name, value):
super(AttributedDict, self).__setattr__(name, value)
def __delattr__(self, name):
Then, access to an attribute which looks like an underscoded string gets
the name decoded and used as an argument to ``__getitem__()``:
>>> d = AttributedDict()
>>> d.foo = 1
>>> d.foo_ = 42
>>> d.foo_, d['foo'], d.foo
(42, 42, 1)
>>> del d.foo_
Adding tab-completion on underscoded attributes to this simple example
is as easy as applying some ready-to-use decorators on the methods used
as arguments to ``proxy_method``. See the documentation of the
``underscode.decorators`` module for more information and examples.
Python codec API support
Since the Underscode package is compliant with the standard Python codec
API, you can use Underscode to encode and decode strings with the usual
``unicode.encode()`` and ``str.decode()`` calls at any time just by
importing the ``underscode.codec`` subpackage (it is not automatically
imported by the main ``underscode`` package):
>>> import underscode.codec
>>> print u'this is \u201ca test\u201d'
this is “a test”
>>> u'this is \u201ca test\u201d'.encode('underscode')
u'this is \u201ca test\u201d'
You can point your browser at http://underscode.selidor.net/ if you want
to download the source code distribution of Underscode. It uses the
standard ``setup.py`` method for installation, runs on any platform and
has no additional dependencies but Python version 2.4 or greater.
You may also be interested in following the development of Underscode;
you can get a copy of its development `Bazaar-NG`_ branch with::
$ bzr get https://bzr.selidor.net/selidor/underscode/trunk underscode
There is a discussion group for Underscode at Google Groups:
It would be great to discuss your opinions and feelings on Underscode in
the group, to know how you used it in your project, and to help solving
yours and others problems there! If you come across a bug or you have
some enhancement proposal, you may use the Trac_ instance available at
.. _Underscode: http://underscode.selidor.net/
.. _Bazaar-NG: http://bazaar-ng.org/
.. _Trac: http://trac.edgewall.org/
Ivan Vilata i Balaguer @ Welcome to the European Banana Republic! @
http://www.selidor.net/ @ http://www.nosoftwarepatents.com/ @
I'm pleased to announce the release of PyEnchant version 1.2.0. This
version includes some important updates in the underlying enchant
library, and implements basic "filters" to allow skipping of email
addresses, WikiWords, URLs, etc during a spellchecking session.
Enchant (http://www.abisource.com/enchant/) is the spellchecking
package behind the AbiWord word processor, is being considered for
inclusion in the KDE office suite, and is proposed as a
FreeDesktop.org standard. It's completely cross-platform because
it wraps the native spellchecking engine to provide a uniform
PyEnchant brings this simple, powerful and flexible spellchecking
engine to Python:
It also provides extended functionality including classes for tokenizing
text and iterating over the spelling errors in it, as well as a
ready-to-use text interface and wxPython dialog.
Current Version: 1.2.0
Licence: LGPL with exemptions, as per Enchant itself
ChangeLog for 1.2.0:
* Implemented "filters" that allow tokenization to skip common word
forms such as URLs, WikiWords, email addresses etc.
* Now ships with enchant-1.3.0, meaning:
* PWLs can return a useful list of suggestions rather than
the empty list
* Hunspell replaces MySpell as the default Windows backend
* Tokenization doesnt split words at non-alpha characters by default
* GtkSpellCheckerDialog contributed by Fredrik Corneliusson
* Removed deprecated functionality:
* All registry handling functionality from enchant.utils
* enchant.utils.SpellChecker (use enchant.checker.SpellChecker)
* Removed PyPWL, as native enchant PWLs can now suggest corrections
http://www.rfk.id.au | This message is digitally signed. Please visit
ryan(a)rfk.id.au | http://www.rfk.id.au/ramblings/gpg/ for details
I'm happy to announce that MetaContract 0.2 is now available for download
what is metacontract ?
Design by Contract allows a programmer to document a function/class with statements
describing behavior. Metacontract implements the PEP-0316 related to this feature
for the Python language using meta classes.
- improve doc string parsing
* ignore the whitespace at the start of the line and around the colon
* take account a single expression if followed the colon
* take account line continuation like the standard Python rule.
- add functions forall, exists, implies
- add a function classmaker for metaclass conflicts.
This announcement also appears on the Metatest web site
*** Metatest - a Python test framework
Metatest is a simple and elegant Python framework for writing tests.
Metatest is mostly about writing tests and by design is not tied to any
particular test runner. Hence the name.
Here's how to write some tests using Metatest. We can think of the tests
as an executable specification.
from metatest.py.mymod import plus, Point
# Function plus adds two numbers.
plus(2, 2) == 4
plus(2, '', _ex=TypeError)
# Class Point represent a point in the plane.
p = Point(2, 5)
p.x == 2
p.y == 5
p.area == 10
And here's one way to run them.
if __name__ == '__main__':
It's not hard to write an adapter that will run these tests in a
different test runner framework.
We gave a talk about Metatest at PyCon UK 2007 and here are the slides
Please visit Sourceforge to download Metatest.
#### PyQt3Support - Python bindings for Qt3Support ####
#### What is this?
PyQt3Support is an extension to PyQt4 that adds bindings to Qt's
Qt3Support library for usage from the Python language.
This is very helpful to migrate existing PyQt3 applications to PyQt4.
Porting from Qt3 to Qt4 can be tedious and bug-prone.
For C++ programmers, Trolltech provides a library, called Qt3Support,
that immensely helps. With Qt3Support, a C++ programmer basically only
needs mechanical changes to your source code. The library is made of two
* A new family of widgets (Q3*) with the same API of Qt3.
* New member functions (or overloads) within standard Qt4 widgets.
For Python programmers, the situation is worse: PyQt4 does not bind
Qt3Support to Python. Developers of PyQt3 are forced to manually upgrade
their code to PyQt4, class by class.
This package fills the gap. By providing a new module PyQt4.Qt3Support,
it enables PyQt3 developers to access Trolltech's migration library, and
thus upgrade their code much easily and faster, with almost only
mechanical changes. It's not a panacea of course: you probably still
need minor manual adjustments and supervising, but it can still be of
PyQt3Support has been developed and tested under both Windows (2000, XP,
Vista) and Linux (Ubuntu, Fedora).
Qt3Support follows whatever license you have for PyQt3 and PyQt4,
because its source code is machine-generated from PyQt3's and PyQt4's
Thus, Qt3Support can be freely used under both the GPL or the commercial
license offered by Qt/PyQt producers.
In case you are interested in developing Qt3Support itself, you want to
know that the script that generates Qt3Support is released under the GPL
PyQt3Support is not complete: it binds about 30% of the Qt3Support, but
don't be fooled by this figure: it's the part that is probably used most
in existing programs (more common widgets, constructors, ecc.).
Moreover, since it is fully machine-generated, it is very easy to extend
it to cover more classes and functions. See below as per how to
contribute to the development.
* PyQt3 ported classes:
Q3VBox, Q3HBox, Q3Frame, Q3Grid, Q3Accel, Q3PopupMenu, Q3MenuData,
Q3DockWindow, Q3DockArea, Q3ListView, Q3ScrollView, Q3ColorGroup,
Q3Header, Q3ListBox, Q3StrList, Q3Table, Q3MemArray, Q3MainWindow,
Q3ToolBar, Q3Action, Q3SimpleRichText, Q3StyleSheet, Q3Mime,
Q3ComboBox, Q3GroupBox, Q3FileDialog, Q3Url, Q3WidgetStack,
Q3HGroupBox, Q3VGroupBox, Q3IconView, Q3DragObject, Q3Picture,
Q3ValueList, Q3CString, Q3ButtonGroup, Q3VButtonGroup
* PyQt4 qt3supported classes:
Gui.QBoxLayout, Core.QNamespace, Gui.QLCDNumber, Gui.QGridLayout,
Gui.QApplication, Gui.QPushButton, OpenGL.QGLWidget, Core.QObject,
Gui.QLabel, Gui.QPixmap, Core.QTextCodec, Gui.QToolButton,
Gui.QTabWidget, Gui.QMenu, Core.QTimer, Gui.QLayout, Gui.QPalette,
Gui.QMenuBar, Gui.QLineEdit, Gui.QDialog, Gui.QInputDialog,
Gui.QCheckBox, Gui.QWidget, Gui.QTextEdit, Gui.QEvent, Gui.QSlider
Matteo Bertini - naufraghi(a)develer.com
Develer S.r.l. - http://www.develer.com
Announcing the release of pprocess 0.3 (previously known as parallel/
pprocess), available from...
Note that only POSIX-like platforms are supported in this release,
although improvements in portability and all other areas are welcome.
What is it?
The pprocess module provides several mechanisms for running Python
code concurrently in several processes. On systems with multiple CPUs
or multicore CPUs, processes should take advantage of as many CPUs or
cores as the operating system permits.
Several different abstractions are supported by the module, including
channels (and communicating sequential processes), queues and a
parallel map function. The module gives developers a certain amount of
flexibility in developing new abstractions, and a motivation behind
the development of the module was, in fact, to discover which
abstractions are most convenient when writing parallel-aware programs.
In order to get a feel for the abstractions and mechanisms provided by
the module, a tutorial has been made available; it illustrates the
process of converting certain kinds of sequential programs into
The module has been tested with non-trivial programs (see the PyGmy
raytracer example in the distribution), but performance results have
been varied: pprocess ensures the utilisation of many processors but
could arguably show better scalability. It is envisaged that the focus
for future releases involve improvements to the interprocess
communications mechanisms employed, along with an investigation into
more effective ways of distributing computations in specific programs.
In the context of recent discussions about Python concurrency support
, this module is intended as a demonstrator for various API
conveniences, with an aim of encouraging standardisation and
potentially the eventual standard library adoption of a useful
parallel processing module.