Python Programming, news on the Voidspace Python Projects and all things techie.
Multiple File Support in Docutils
One thing that has limited the use of docutils (the project which gives us ReStructured Text markup) is its inability to handle multiple documents.
To link between documents you have to link to the specific output format (html and LaTeX are the most common, but there is also support for writing ODT documents and others), which means that you can't create cross-linked multi paged documents in a writer independent way.
You also can't use docutils to create table of contents for multi-paged documents, something that would be really useful for rest2web.
This might all change though. Lea Wiemann has a Google Summer of Code project to add multiple document support to docutils.
Along with the recent work to move the Python documentation to ReST format (which may or may not come to fruition - but the signs are good) and the debate on the docutils-develop list about adding syntax highlighting to docutils is really good news for documenting Python projects.
Whilst we're on the subject, at Resolver we are finally using the documentation tool I wrote last Christmas. The combined fix to code objects in IronPython 1.1 and the inspect patch in FePy means that it now runs under IronPython instead of having to use CPython. The nice thing was, that after porting to IronPython it pulled together docs from our modules straight away. We are using this rather than one of the other Python systems is that we want to heavily customize which parts of the API are documented and which aren't.
Resolver is going out to a range of beta customers over the next few days, so good API documentation is very important.
Oh, and important news: Brett Cannon has finished a secure version of Python. Sweet.
|||I'm assuming here, but it sounds like a female name to my uneducated English ears.|
Movable Python to Go Open Source? Maybe...
Having Movable Python as a commercial product, rather than Open Source, has been an interesting experiment for me.
Movable Python started as an idea for testing standalone applications. I thought it would be nice to have a 'generic' standalone Python so that I didn't have to recompile scripts with py2exe every time I made a change I wanted to test. It also turned out to be really useful for a machine that I couldn't install Python on.
When I released the first version of Movable Python on sourceforge, it quickly had several thousand downloads and I spent quite a lot of time fixing problems that other people were finding. In all the time it was open source, and used by a lot of people, I only had one donation.
At the time I had lots of ideas for improving Movable Python, but was annoyed that so few people (who seemed to be using it) were prepared to contribute either there own time or any money for the effort I put in. Welcome to Open Source I guess.
Since being a commercial product, Movable Python has been purchased by a few hundred people and I've enjoyed the feedback I've had from users. Unfortunately I'm not now able to devote as much time as I would like to the next round of improvements. It also seems that having Movable Python free would be good for the Python community, for example for creating generic PyGame executables.
What I have decided to do, is to release Movable Python as Open Source after the next 500 pounds worth of sales. That is either one hundred sales of a standard distribution, or thirty-nine mega-packs, or some combination of the two.
I will release, subject to a BSD License:
- The 'compiler', which allows you to build custom distributions
- The source to the runtime and user interface
- The pre-built distributions
So now, if you buy Movable Python you will be helping move it become open source as well as contributing to the PSF and OLPC. As well as being a good way of making some contribution to two worthy projects, it is also a nice way to bring this 'commercial phase' of Movable Python to a close.
Once it is Open Source, it should prove easier to port the compiler and runtime (much of which is portable - pun intended I'm afraid) to other platforms.
Movable Python can be purchased from:
On the vague offchance that anyone who already has Movable Python wishes to contribute, or you would like to donate more than the nominal cost, my PayPal address is:
The reasons why I am not just releasing it as Open Source immediately include that it really has been a lot of work (their are a lot of workarounds in the runtime to fix issues) and I'm not currently using it, and also to try and avoid annoying those who have recently paid. So, if you are interested in trying Movable Python, you now have to make the trade-off of either contributing to its release, or waiting for it to happen anyway (which will probably be a few months and of course will take longer if you do that)...
Anyway, I'll keep you updated as to how it is going.
IronPython Wiki Cookbook
One of the things I've been working on in my 'spare time':
This is a wiki with information about IronPython and code examples of how to achieve common tasks using IronPython and the .NET framework. There are links to my IronPython Articles (of course).
New code examples include:
- Getting Started
- Sending Udp Packets
- Receiving Udp Packets
- Download a Webpage
- Databases with Odbc
- Accessing the Registry
- Speech Synthesis - Making IronPython Talk
There is a lot more to be done, but I hope this will be a useful resource for the IronPython community. Registration is required to create and edit pages, but if you have some useful examples of IronPython then please add them.
If there is anything you want to know how to do with IronPython, then the IronPython Mailing List is a great place to ask. Useful code that turns up there will hopefully end up on the Wiki too.
I Can Has LOL Code Now Plz
Things get weirder though, today we discovered lolcode: I HAS 1337 CODE. LOL!!1
This takes the odd and cutsie language of the lolcats and turns it into executable code. For example:
HAI CAN HAS STDIO? I HAS A VAR IM IN YR LOOP UP VAR!!1 VISIBLE VAR IZ VAR BIGGER THAN 10? KTHXBYE IM OUTTA YR LOOP KTHXBYE
Stranger than a grasshopper's banjo...
(Oh, and this: Linux sponsored Indy 500 car comes in last - crashed due to driver problems!)
Obscuring Email with Web-Form Fallback
Everyone knows that putting plain email addresses into a web-page is asking for trouble. The spam-spiders roam the internet, hungry for fresh prey .
There are various options for obscuring email addresses, one option being to use a 'contact form' instead. On Delia's Translation Page I wanted to use real email address, but to obscure them as securely as possible.
|||I really should implement SpamTrap, although there are Similar projects around.|
Import with Reload
Often when developing a module I want to test it in an interactive environment whilst I'm working on it. reload only works with modules, which means that to use it you have to reference your objects as Package.Module.Name; which is a pain in the doo-dabs.
This function is a helper function that allows you import names from a module or package, with a reload.
mod = __import__(moduleName)
components = moduleName.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
mod = reload(mod)
if isinstance(names, list):
output = 
for name in names:
return getattr(mod, names)
spam, eggs = importWithReload('Package.Module', ['spam', 'eggs'])
It takes a module name and either a single name or a list of names to import from it.
There are some interesting articles and blog entries on IronPython that I've stumbled across recently:
Second Life Insider has an interesting article (by Tateru Nino) on building a bot in Second Life - using libsecondlife and IronPython!
Steve Gilham posts some work-arounds for using the PyFit module with IronPython 1 and 2.
The Lazy Coder presents a (terse) report on using IronPython with .NET 3.5.
Saveen Reddy has a blog entry illustrating how to enumerate your Windows Media Player library contents, using both Powershell and IronPython.
They're all posted to IronPython-URLs, but I guess not all of you read it.
Man, Firefox is a hog. It leaks memory like a sieve. I've been setting up a new site and it was behaving a bit sluggishly. It was using 512 mega-bytes of RAM, with nine tabs open. I closed it down and re-opened the same pages. It is now only using 158meg, which is still a fair chunk of memory.
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.