python

Make a Windows installer for your python module

To help you build and distribute your Python packges, Python provides distutils. This library knows how to bring together your modules, where to put scripts and how to compile C extensions. The process is driven by a setup.py file, written by the package author or maintainer. Depending on what argument is passed, setup.py can install the package, build an archive or build an installer. To create a Windows installer for a module called wibble.py proceeed as follows.

Create a setup.py file in the same directory as your existing module(s), describing what is to be installed:

from distutils.core import setup
setup(name='Wibble',
      version='1.0',
      description='A utility to deal with underpants and pencils.',
      author='Fred Bloggs',
      author_email='fbloggs@example.org',
      py_modules=['wibble'], # Add more modules as desired
      )

Run the following command:

python setup.py bdist_wininst

This will generate wibble-1.0.win32.exe, which can install Wibble on any Windows PC already having a version of Python. As a bonus the bdist_wininst command doesn’t itself require Windows, so you can create the installer on Linux or Mac OS.

EuroPython 2009 open for registration

If you’ve enjoyed PyCon UK the last 2 years, the bad news is that it won’t be happening this year. The good news is that  EuroPython 2009 is coming to sunny Birmingham instead, for 3 days from Tues 30th June to Thurs 2nd July and registration is now open. The even better news is that until 14th March it’s really cheap, like 50% off cheap making the 3 day conference only £95.

As a warm up, from Sunday we have 2 days of tutorials at the bargain price of £70. To close there will be sprints from Friday 3rd July, and in case any Django coders get home sick it all coincides with the Birmingham International Jazz Festival.

My talk on ArcGIS and IronPython has been approved. So I’ll see you there.

Another Python cheat sheet

I couldn’t find a Python cheat sheet that I liked, so I made another.

It’s rough, but pretty usable. I need to make better use of space/colour, choose a clearer font and link it into the Python docs.

The license will be either Python Software Foundation License or CC-Attribution. Comments and suggestions welcome.

Tabular data with Python slides, from PyCon UK

At PyCon UK 2007 I gave a short talk on using Python to deal with tabular data. The slides, demos and modules for my talk are available for download.

There is material in the download that I didn’t present on the day. The talk covers extracting data from various tabular data formats. This is the first step of an Extract, Transform Load (ETL) operation. It also summaries the character of those data formats.

Comments, queries and suggestions are most welcome.

Python implementations matrix

For the last week or so I’ve been putting together a spreadsheet, to compare the various Python implementations on support of PEPs and library modules. It is ready for a first release, but far from complete:

  • CPython 1.5 – 2.5 coverage is good.
  • IronPython 1.0 – 1.1 has library coverage
  • Jython only has release dates
  • PyPy has not been started

I’ve uploaded as an OpenDocument Spreadsheet: Python implementations matrix. Alternatively, for those stuck with Excel, it is also available as an MS Excel workbook: Python implementations matrix (xls)

Comments, suggestions and emails welcome.

PyCon UK early bird registration

PyCon UK, the first UK community Python conference, is taking place in Birmingham on the weekend of 8th – Sun 9th September 2007. Extra early bird registration ends on Monday. We’re offering both days including access to all tutorials, talks, sessions &  the conference dinner for the fantastically low price of £50 if you book in the next 3 days. Registration will remain open until the first day of the conference, but book early to save more.

Proposed talks so far include:

  • Introduction to Python for programmers new to Python
  • Introduction to PyQt GUI Programming
  • Developing with IronPython
  • An Introduction to Django
  • The Report Lab pdf tool kit

More are coming, our call for proposals is open. I look forward to seeing you there.