Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

March 28, 2009

PyCon 2009 Day 1

Way too much stuff going on to fully describe it. I should already be in bed, as tomorrow I want to be up early enough to see Jesse Noller's lightning talk: he had me do some graphics for him (so for Heaven's sake don't expect anything classy - we haz gimp but do not really know how to use it :)

Finally got to read Kirby Urner's instantaneous blog of my tutorial session yesterday. Great verisimilitude, lends an authentic flavor to his description.

PSF Members' meeting at lunchtime gave very good results: all members and sponsor members elected/ratified, board now expanded to 10, new bylaws adopted (thanks, Stephan Deibel) and motion to discard logo trademark protection defeated.

My presentation The State of the Python Community: Leading the Python Tribe took too long to present as I didn't have time to shorten the slide presentation, so I only had ten minutes to exchange ideas, but discussions afterwards made it obvious that some people with valuable information are intimidated by the level of research and/or determination it takes to get through to someone who can update the web site. Also there is a lot of enthusiasm to help the PSF. Apparently Jacob Kaplan-Moss is at least toying with the idea of stepping up to help the PSF volunteer web team. That would rock.

Brief hiatus followed by a short Board meeting. I am chairman for another year, and we decided on a couple of Python Community Awards. I was stunned (in the most pleasant way) to be able to view a recording of my session in the Green Room two hours after I had started presenting it! Way to go, audio-visual guys. When this stuff hits the met it will make tech news. They really *are* good.

On to dinner with my Board colleagues plus Allison Randal of the Parrot Foundation, Liew Beng Keat from the Singapore user group and Luciano Ramahlo of Brazil. The Board's only chance to socialize through the face, so an important occasion even if the table was a little long and narrow to allow round-table communication.

Then back to the hotel for a quick drink, a look at today's tweets and a bout of email responding before finally capsizing into bed after finishing this post. Always busy at PyCon. Time flies when you are enjoying yourself. More tomorrow ...

March 27, 2009

PyCon Tutorial Slides

My PyCon tutorial attendance was closed at 60 students, but there were a few spare seats still due to dropouts and such. Next year some way of allowing wait-listed students the flexibility of a last-minute change would be a small improvement.

Extremely happy that this is the most negative thing I can imagine saying about the way Greg Lindstrom and his team ran the tutorials. As a presenter I have nothing but praise for the way the organization supported me: all I had to do was follow the line of least resistance. That always makes it easy for a presenter.

Please post any questions or corrections about the slides as comments.

Thanks to everyone who supported PyCon by coming to the tutorial. What should I do next year (when I think I will limit myself to one)?

January 28, 2009

PyCon Tutorial: Terrific Response

I've just seen the statistics sent out after the day one signups for PyCon tutorials, and Python 401: Some Advanced Topics already has eight signups! Thanks very much to everyone who has shown so much confidence in this tutorial. If there are specific points you'd like to make about your expectations of the session then please let me know here.

Ken Whitesell has already made one suggestion, which I am going to try and adopt. Thanks for the feedback, Ken.

December 28, 2008

PyCon 2009 Presentations

I've just been thinking about planning for PyCon, and I have a lot to do. The tutorial schedule is a little bare right now, but I am hoping it will be fleshed out soon. There are over 30 tutorials, two of which I am involved in.

Firstly I have to write Python 401: Some Advanced Topics (not my own choice of title), which is supposed to discuss iteration, generators, descriptors and metaclasses. These are all features of Python that could stand some more explanation, but I'd like to put a twist on the material and have the audience suggest potential applications that we can discuss as a part of the tutorial.

There's a second tutorial, Python for Teachers that I'll be presenting jointly with Kirby Urner. The idea behind this one is to try and enthuse those involved with formal education about Python's potential for teaching mathematics of various kinds. Kirby has a lot of experience doing that, and I am supposed to provide irreverent questioning and keep Kirby headed in the right direction. He's the education side, I represent the geeks, if you like. I'm really looking forward to it, but I owe Kirby email about those plans.

Then I have to give an invited talk which I believe will be a plenary session, though that hasn't been confirmed yet. My working title for this is Leading the Python Tribe, in which I want to investigate the shared sense of direction in the Python community, in so far as it currently exists, and offer some thoughts about the roles of the Python Software Foundation.

I am also hoping to run an Open Space session along the same lines as last year's Teach Me Twisted, but this time looking at web testing - an area I would really like to learn more about. I think I have Grig Gheorghiu interested in helping out, but he's a busy guy and hasn't yet committed. If anyone can rope in the knowledgeable web testers we need it's Grig.

To top this all off there'll be the PSF members meeting to chair, sundry sessions in the bar, meals with friends old and new, and all the other wonderful things that happen at PyCon with absolutely no formal scheduling. So I expect to be busy, but I also expect to enjoy myself hugely. See you in Chicago?

September 22, 2008

PyCon Tutorials, 2009

So, the call for tutorials has gone out, and I am thinking (yet again) of offering at least one. In the past my tutorials have been of an introductory nature: the DB API, wxPython, and last year I taught Python itself (or enough of it for newcomers to be able to understand conference talks) in three hours.

So, what would people like to see this year? I'm minded to do something a little more advanced this time, so I can feed it into Holden Web's public course schedule.

March 14, 2008

Practical Applications of Agile (Web) Testing Tools

This was a practical tutorial by Titus Brown and Grig Georghiu, two accomplished presenters who have given popular presentations at the last two PyCons. Titus opened the presentation, and told us he wanted us to be "test infected" - to make testing a necessary part of our development process. He confessed he feels a sense of physical discomfort when he writes untested code.

He gave us a number of practical guidelines, the most interesting of which were: start small; focus on actual problems; use continuous integration. The goal of testing should be to fail as quickly and as hard as possible: failure is good, because it reveals a need for revision. You should plan for testability, and as your experience level increases you will find that you naturally tend to do this.

Use a hierarchy of tests. The initial tests should run in under 20 seconds; only if those tests pass should you run the full test, which will take longer; then run regression tests, and then (if you have defined them) the acceptance tests. The point is that much of this work isn't done on your time: your continuous integration may be an overnight run, but you don't have to stay while they run. Titus feels that any test that takes over a couple of hours has limited (though definitely not zero) value, due to the lack of immediacy in the feedback it provides.

Taxonomy of testing: unit tests, functional tests, regression tests, UI tests, acceptance tests, integration tests, continuous integration, performance tests. Do you even know what all these are? Which to you need to define and use?

The more complicated it is to run the right tests, the higher the probability they won't get run. Titus talks about different strategies: TDD (Test-Driven Development) and SDT (Stupidity Driven Testing) , which he equated with TED (Test Enhanced Development). The general myth is that you are a bad person if you don't use TDD, but SDT is very important because you can ensure that bugs get properly squashed by adding specific tests after discovering one of the gruesome faults we all put in ur software from time to time.

Tests can be used to constrain your code; they force you to document your expectations, both internally and externally. internally, use more assert statements. Externally, write unit, functional and regression tests as "black box" tests to verify external behavior.

A "test umbrella" removes the need for memory. Everything should report back to a single source. This gives you a way to tell a new developer "run this; if it doesn't work, you have something to fix". You just have to remember to run the tests, not go through some complex sequence of commands that need separate documentation. This automation investment will reap big dividends in both time and quality.

Testing really helps when you want to refactor.

While code coverage may not be a good metric, it's definitely the case that if you don't run every line of code at least once in your tests then the possibility of failure becomes much higher. Line coverage is necessary, but not sufficient. Continuous integration helps you discover less obvious errors, like changes in process you forgot to document.

WSGI intercept is a useful test mechanism because it monkey-patches the Python web libraries.

[Interesting demos; I went for water for the speakers just before they started; my tests failed, and I never discovered whether they were supposed to or whether I had missed some crucial step while I was out].

The scotch tool is a recording proxy that will record everything that passes between the browser and the server: exceptionally useful for capturing AJAX interactions. It can also replay recorded sessions, and ensure that the responses that come back are "the same" (with minor exceptions such as ignoring date changes).

Figleaf is a code coverage recording tool. It saves it results in a pickle-based format, and can perform intelligent comparisons between tests, taking the union and intersection so you can easily discern what still needs testing.

Nose is a system that allows testing with a much lighter footprint than unittest. It will also all other doctests and unittests it can find if properly encouraged to do so, and can be used to add module-level setup and teardown.

Grig then took over and first described and then demonstrated Selenium, a testing tool written in Javascript that runs inside the browser (and probably one of the best-known web testing tools). It's one of the few tools that can adequately test AJAX functionality, and it's the default testing tool at Google). It has several components.

The core is augmented by an RC (remote control) module, and IDE (a Firefox add-on), and a Grid module that seems to relate to parallelized testing.

The biggest issue in defining Selenium tests is locating the required elements in the page. It would be much easier if web authors gave all elements IDs, but in practice you often end up using xpath, which has downsides. Many times there is no other way.

The IDE component allows you to record interactions with web servers, but again you have to be careful to use repeatable event sequences (e.g. pasting is not repeatable); the IDE is probably not as easy to use as Twill, but some AJAX applications are almost pure client-side, with very few server round-trips, and Twill is useless with these as it can't intercept the traffic.

Firebug is an essential component in developing the tests, as is the XPath Checker add-on, which helps greatly in generating the element locators.

The basis of Seleniun tests is a long string of locators and assertions. Selenium RC runs as a reverse HTTP proxy, bypassing the "same origin" cross-site scripting protections that normally insist that scripted content has to come from a single domain. By fooling the browser this way remote control allows you to write test of a remote server inside the local proxy. It also allows you to build simple looping constructs. Of interest to readers will be its ability to export test cases as (rather ugly) Python code. Google has a whole team working on Selenium, and others are also working to improve it, and extend it to broader browser support.

Grig then went on to describe buildbot, a continuous integration testing tool that allows a master system to run build (or indeed any other) commands on remote slaves and aggregate reports from the clients in a simple, readily available web format.

Although some people perform continuous integration on a single platform, buildbot was designed from the start to allow the master to drive the same tests across multiple clients and thereby discover cross-platform bugs that might otherwise go undetected.

Greg ran us through a configuration file. The learning curve can be steep, but once your buildbot is configured it usually needs little maintenance. He also highlighted the fact that someone has to keep on top of buildbots and avoid bitrot by displaying the currrently parlous state of the Python buildbot farm. Many clients are down, and those that are running appear to be failing their tests.

The evening closed with a brief discussion of Fitnesse, which is a higher-level tool that has you define tests declaratively in a language that allows you to refer to the concepts of the application domain; this makes them easier for the customer to comprehend, for example. The tests are maintained in a wiki.

I was beginning to flag a bit by now, so I can't really give you an intelligent summary better than Grig's "it's a Wiki that runs things". Ideally the client will at least understand the test descriptions.

All in all an excellent and enjoyable presentation that not only gave me some great ideas for testing but also left me more determined to introduce it into my web projects.

Getting Started with Pylons/TurboGears 2: Modern Python Web Development

This presentation was as frustrating for me as it probably was for the presenters, Mark Ramm and Ben Bangert. Unfortunately the examples for the first part of the tutorial relied on having up to date copies of lots of packages, and the audience were unable to download them from the Internet as the hotel staff appeared to be having some difficulty connecting 500 geeks to the fat Internet pipe through their wireless infrastructure, and connectivity was extremely intermittent.

Things went from bad to worse when I finally managed to download the required software from the Internet and found that my examples failed: it turned out that only the presenters' machines had the necessary combination of packages. Consequently a lot of the first hour was wasted in trying to organize a thumb-drive bucket-brigade to ensure that all present had the needed stuff loaded. I can understand Mark's anxiousness to present the latest and greatest TurboGears to the audience, but I was there primarily because I wanted to get back into the technology so as to be able to make fair comparisons with Django.

While we were trying to get the load problems sorted out, mark talked about the WSGI interface and its role as a standard in the Python web world. He then talked us through a couple of practical applications, and I ended up with a simple server working based on the reference implementation, wsgiref. We then implemented the same functionality using cherrypy.wsgiserver, observing that the fundamental techniques weren't particularly different. The third exercise didn't actually add much for me, since we just had to get the existing servers to replace the initial output with a listing of the environment dictionary.

Then we moved on to TurboGears. Alas, I ended up typing in code from the handout while Mark was explaining the supporting functionality, and when all was said and done I didn't notice a lot that was new in terms of how you put a TurboGears application together. In one way this is very good, because it means that the TG re-implementation has retained the same API that its developers have become familiar with; in another it's bad, because I didn't feel I actually learned all that much as someone who had already put TG applications together, albeit small ones. Much of what was said was narrative about the state of the software rather than directed towards learning the technology. I didn't have the sample web finished, with nine pages remaining of the handout by the time Mark's part of the session was over.

Ben Bangert then proceeded to explain the differences in philosophy between TurboGears and Pylons. I'm sorry to say that my experience on the first rather-more-than-half of the tutorial left me unable to concentrate sufficiently, and I didn't absorb as much as I would have liked. I don't remember any practical work at all, and I didn't end up with a handout, but I don't know whether I missed it or what.

This was the first of a matched pair of tutorials, the second discussing advanced use of TG and Pylons. I didn't attend it because I was booked on something else in the evening session, so I hope that those who did found that this tutorial had provided them with the necessary background.

February 18, 2008

Python in 3 Hours?

As I work through the slides I am beginning to realize that I have set myself a very ambitious target for the Python 101 for Programmers tutorial at PyCon this year. I currently have 135 slides, which means I have roughly eighty seconds to cover the points on each slide. I normally plan on three to five minutes, so the presentation style is going to be a little terser and more rapid-fire than is my custom.

It's currently the best-subscribed seminar with a total attendance of 37 (!). As it was clearly flagged as being for experienced programmers who didn't know Python I hope that I am bringing a bunch of newcomers in to the Python community and helping them to make sense of the rest of the conference.

While I remember, Early Bird conference registration closes on February 20, so sign up now before it costs you more money!

February 6, 2008

PyCon Registration Going Great Guns

With over five weeks still to go until PyCon 2008 in Chicago registrations already number over 180, almost three-quarters of the total registrations for the first PyCon in 2003 in Washington DC. The tutorials, running for the third year, are also popular and many of them already have enough registered students to guarantee that they will run.

I'm delighted to see that my own Python 101 for Programmers is a popular offering—it's intended for people who have had little or no previous exposure to the language, and I am trying to cover all the essentials in three hours! Let's hope that it brings some new members to the Python community.

If you have never been to PyCon, I would like to recommend you try it. It's definitely not a stuffy atmosphere, people go there to have fun as well as do productive work, you can learn huge amounts from both the tutorials and the regular papers, and the sprints are a great way to get into a new project and learn from the developers themselves.

It's a unique event, besides being terrific value for money.

January 7, 2008

Teaching Python to Programmers

Well, PyCon is now less than three months away, and the most recent event of note was the announcement of the list of tutorials. I am happy to say that my own proposal was accepted, so one of the offerings is Python 101 for Programmers.

The intention is to give experienced programmers who are new to Python enough insight into the language that the simpler PyCon sessions will make sense to them. PyCon is an incredibly valuable resource for promoting the Python language, and I hope that all readers will encourage programmers they know to come to the conference and learn more about this interesting language. Of course I'll be happy to see them in the tutorial too!

The PSF has made real attempts in the last couple of years to evangelize the language, but ultimately the lesson of evangelism is: the best promoters of a language are its enthusiastic users. It seems to me that Python is crossing the knee of some curve right now, and acceptance is improving to the stage that it's getting hard to find Python programmers.

Of course there's another reason for going to PyCon if you are looking for a job. The biggest and best Python employers have realized that PyCon is the easiest place to make contact with the community. You only have to look at the list of past and present sponsors to see that.

So, I hope to see you all at PyCon, preferably in the company of a programmer who's just starting out with the language!

November 16, 2007

Your Chance to Talk at PyCon

If you've been thinking about submitting a talk or tutorial proposal for PyCon next year you have a few extra days. David Goodger, the chairman, has just announced a short extension to bring the deadline the other side of this weekend, at midnight (Chicago time) on Monday November 19.

You can see the original calls for talk proposals and tutorial proposals on the PyCon web site, where there are also lots of ideas for talk topics, and also some tutorial topic suggestions from last year's delegates.

Don't be a consumer - talks at all levels are needed to keep PyCon the vibrant meeting it has become. Help the Python community out, and make a name for yourself!

February 22, 2007

Tutorial Is Ready

I wanted to make sure that the tutorial materials were available on the web before I started this year. Sean Reifschneider established network connnectivity earlier this evening, meaning that those students who can't read a thumb drive will be able to download the slides and sample code.

So can anyone else, come to that. I hope that the materials will be helpful to anyone who wants to learn to use databases from Python.

January 23, 2007

Lots of PyCon Good News

The PyCon blog announced today that pre-registered attendance has now reached 400. After a pause in growth last year (due to the change of venue?) I am happy to see that Python's continued increase in popularity is being reflected in PyCon's attendance figures. It is, after all, the primary US conference for anyone with an interest in the Python language.

Sponsorship is also on the increase, and I am delighted to have exceeded the target that the co-chairs set me when they put the budget together. This is the first year we have attracted five Platinum-level sponsors. Thanks to everyone who is supporting the conference in this most practical of ways. I hope all my readers will take the time to follow their links at the right-hand side of the PyCon web pages. It's also not too late to sign up as a sponsor - where else could you get your organisation's name on the web next to both Google and Microsoft?! The details are here.

On a personal note the database API tutorial is going ahead. The lower numbers this year should allow time for questions and personal tuition. I'll have to get working on the slides and examples now!