This is a course targetted at programmers who are interested in wrapping libraries as Python modules. It teaches the vanilla Python/C-API as described in the reference manual using libcsv as an example.
The aim is to allow programmers to wrap libraries so that they can be driven from Python (either for testing or to use Python as a glue language) and to familiarise people with the innards of the interpreter so that their understanding of Python itself is improved.
The course will use Python v3.1.2 and will build up a pythonic wrapper for libcsv from scratch in a test driven fashion. py.test will be used to run tests. The overall flow of the course will be to describe a feature, write failing test for it, implement it and then discuss things. The aim is to provide a well tested wrapper for the library. A more detailed outline follows
- Introductions to Python extenions - Why, when and how
- Conventions while creating C extensions for Python (naming, layout etc.)
- Structure of a Python module written in C and description
- Test setup
- Wrapping libcsv
- Importing and module data
- Handling data at the Python/C boundary
- Exception handling
- Custom types
- Making the wrapper behave like a Python object
- Debugging (gdb and the Python interpreter)
The entire course content and material are original and hand crafted. This is not a rehashed tutorial from various sources on the web.
The course will be a two day event. The training will run from 930 to 1730 on both days.
All participants must come with a laptop to the course. There's going to be quite a bit of coding to do so make sure that your tools of choice are installed and ready on your machine.
The laptop should have the following software installed on it.
The tutorial will be done on a Gnu/Linux platform and it would be best if the participants used the same.
Registered participants can contact me before the training if they need help with installation and setup so that we don't waste time at the venue.
This is not an introductory Python course. Participants are expected to be proficient with C and have atleast passing knowledge of Python. Make sure you're well rested since there's going to be a lot of content and much of it quite subtle.
All participants will get a spiral bound copy of the course notes.
There will be a "homework" exercise which I will accept for 2 or 3 weeks after the course is complete that I will offer comments on to cement all the concepts taught firmly.
Hints, allegations and things left unsaid
Lunch and tea will be provided to participants as part of the course. Internet and power will also be provided. You will have to arrange parking for yourself. You will also have to bring your own laptop to the training.
For details on other trainings, to stay up to date about classes that I offer or to arrange a custom training for a company, please refer to to my trainings page.
For any clarifications, please contact
noufal at nibrahim dot net