20 julio
2010

europython 2010: First conference day

what's that sensation of joy I felt.... ;)

Europython 2010

Let me advice you, if you ever come to this part of UK (if you've never been here before) that the dawn is near 05:00 in the morning. If the light does bother you when sleeping, search for a hotel with courtains of some sort.

I woke up at 07:15, I had a quick shower and I did some clean-up of my stuff (I put everything back in my travel bag). I left the hotel at 08:00. Just after leaving, I met Denis Bilenko on my way to the Birmingham Conservatoire. Denis is going to give a talk on thursday about the gevent network library and we talked a little bit while walking to the conference building.

I got some problems entering the conference, as they didn't find my identification badge (WTF, next time I'm going to use Wu as my real name, as this happened to me back in 2008 in the djangocon in San Francisco and last year here in birmingham too :(). Finally I managed to find the badge myself, so I could get all the goodies (A nice black t-shirt, a mug from bytemark hosting and the usual list of atendees and advertisements of all kind).

With everybody seated in the Adrian Boult Hall the opening event started and the crew was introduced to everybody (just like last year):

The crew from Europython 2010, this year in a red t-shirt.

New and improved talk

Michael Foord giving the new and improved talk.

First talk I attended to was New and Improved from Michael Foord. He covered some of the stuff in the unittest module. As a newbie to the testing world, it was an interesting talk, but probably it was more productive for people with some background on the topic.

Good tests, Bad tests talk

William Reade about Good tests and bad tests

After a small break to have a coffee (and talk with a nice guy from Bombay called Safe) I went back to Adrian Boult Hall to attend Good tests, Bad tests from William Reade. This was a little more interesting to me, as he covered some good tips when thinking about TDD and writing tests for new and legacy applications.

How import works talk

Brett Cannon on How Import works

Next talk, before the lunch break, was How import works. In this talk Brett Cannon talks about how the new import rewrite for Python 3 works, covering some of the new internal features like finders and loaders. I've to say that I find that there are a lot more talks related to python 3 this year, which is nice (in the end, the whole python world will have to move sooner or later).

Lunch time!

For lunch we had some chili with meat and rice (really, really, really spicy) and a variety of desserts (I picked up tiramisu, which was quite good indeed). The path to the room where we got the food (the cafeteria of the conservatoire) was full of papers and posters about the exams and qualifications of the studends, as well as some information on different methods and courses you could use/join to learn playing all kinds of instruments. As a guy told me while waiting in the queue - "It is never too late to learn playing music".

The Python-PostgreSQL soup talk

Hannu Krosing on PostgreSQL Python soup.

After the lunch break I attended one of the big ones (at least for me), PostgreSQL's Python soup. The talk abstract showed that it was going to be a talk covering the different Python-PostgreSQL connectors, explaining differences between them, showing some code examples and things like that. Too bad Hannu Krosing seemed to be so nervous he didn't manage the talk too well. He waste a lot of time in the beginning, not only trying to explain who he is and what he does, but to explaining what PostgreSQL is and the advantages of relational databases (which imho was a little bit outside the scope of the talk). Talking with some people at the #europython IRC channel in Freenode seems everybody ended with this same sensation about the talk. UPDATE: Later on, someone explained to me that he didn't sleep more than 2 hours last night and that he was really tired and that he had told some people to make noise if he got sleep while talking :O

Testing HTTP Apps with Python3 talk

Łukasz Langa and his mate talking about his Monstrum testing application.

Following the main topic of the day, testing in Python, the next two talks were somehow related as both covered tools for functional testing. Testing HTTP Apps with Python3 was an introduction to a soon-to-be open source project that will be called Monstrum (monster in polish), developed by Łukasz Langa (and some more people) in Poland. Lukasz and his mate began with three examples (based on true stories) to show us how important tests are and how you can shoot your feet if you don't use them. Then he covered the main features of the software and they also covered some reasons for the software to be written in Python 3.

Python and Selenium Testing talk

Pythonand Selenium testing, with Raymond Hettinger

Python & Selenium Testing was driven by two people too, Raymond Hettinger focused a little bit more on the company behind Selenium, giving us some information about the services they are offering off the cloud, based on Selenium itself (some of them are very impressive) and he even gave us access codes to test the full services for free while we are at the europython (jay!).

Pythonand Selenium testing, with Jason Huggins

Jason Huggins focused more on the internals behind Selenium and how powerful it is to perform funcional testing emulating almost any kind of browser-and-os combo available. He performed a half-life/half-recorded demo to show us how to remotely call a Selenium install on a virtual machine to run some tests on a browser. Nice that, well done guys!.

Coffee break and books

Then it was time for another break. This time getting a coffee was really difficult, as everybody was there on a queue to get some. I got a coffee and I stopped by the OReilly stand (Oh! No! ;D) just to take a look at some books. Of course I stopped at the Packt Publishing stand too (quite small comparing it with the big OReilly one). I'm sure I'll not be able to avoid my usual book-hungry and I'm going to buy 2/3 books O:) (in fact there are some testing, security and regexp books that I don't know why they are not already in my bag!).

Testing in Python with py.test talk

Testing python with py.test, Holger Krekel

After the break I attended another talk related to testing software, this time Testing in Python with py.test by Holger Krekel, covering the use of py.test an old but currently maintained option to do testing in python (both unit and functional testing). py.test is a lightweight and easy-to-use tool to perform tests on your code and it has a big plugins repository that allow you to achieve a lot of things when doing your tests (including some django-related plugins or plugins to integrate tests from the standard library unittest or nose).

The testing panel, asking the experts difficult questions

The testing panel, with all the experts!

To end the day an interesting panel about testing (what else?!). The panel was driven by Ali Afshar and the testing experts were:

Some of the questions discussed include:

  • Are doctests a good or a bad thing?
  • How can we better encourage people to test?
  • Which is the best unit testing framework and why?

Some people from the audience shooted some interesting questions aswell.

Spare time, beers and social

When the day was finished at the conference, I went back to the ETAP, drop some things on my room and I refreshed me a little bit (it is really hot in bham on July). Then I went down to use the hotel's lobby free wifi and try to find out where the people were going to meet today. Long story short: the wifi didn't work, but I was lucky that Antonio Cuni appeared as I was able to join him in our way to the center of Birmigham.

It was really funny because when he told me his name was Antonio I just told him - "Hey, que tal?" - thinking he was also spanish (c'mon, you see the name??!???) but he is from Italy ;).

We went to the city center and we had a pizza for dinner. We had a nice talk while having dinner, both about his work with Python (he is one of the maintainers of PyPy) and about some other things like the football world cup ;).

After dinner we went to the Walkabout, a really nice place were we join some Zopistas from the netherlands and some other people. What a place, if you ever come to Birmingham, you have to stop by and have a beer listening to the good live music.

Here you have some pictures I took while walking around:

The Mailbox

The Mailbox

Now off to bed, let's see what happens tomorrow!

Posted by wu at 01:30 | Comments (0) | Trackbacks (0)

europython 2010: TinyHTTPProxy and troublesome wireless

There are always those good things you learn or discover while being in this kind of events

Europython 2010

I would like to write some lines about a small (but really useful) script Antonio Cuni showed me yesterday. It is not a script he had written by himself, and probably you could find it in the Internet (UPDATE: In fact it is called TinyHTTPProxy ;D).

While having some beers at the Walkabout last night, we tried to connect to the Internet using my laptop and the Walkabout free wifi, but (after many tries) we found out that it didn't play well with the https protocol. Each time a website (like twitter or gmail) was redirecting us to a secure https connection the connection just got stucked.

My first solution was quite a bit dirty. I opened an SSH connection to one of the machines I've at home, setting up a tunnel like this:

ssh -L 443:twitter.com:443 user@myhost

That will cause that each request sent to https://localhost on my laptop will be forwarded through the tunnel to my box at home, and then it will be forwarded to twitter.com. Then I added a line like this to the /etc/hosts file (yes, that works in OSx too ;D):

127.0.0.1 twitter.com

It mostly works (the Walkabout wifi was a little bit troublesome anyway). From time to time there were timeouts and it was not so usable.

The solution Antonio provided was, indeed, by far more elegant. He showed me this python script which is a fully-functional http proxy in only 123 lines of code!. Amazing, isn't it?

All you need is download it and execute it, for example, in your home box (or any other box out there you can reach):

python proxy.py

It will listen on port 8000 on that box:

Any clients will be served...
Serving HTTP on 0.0.0.0 port 8000 ...

Then you only have to modify your browser to use a proxy connection with http/https/etc requests using the hostname/ipaddress of that box as the proxy address. We tried that and it worked just perfectly fine, but with the limitations of the flaky wifi inside the pub.

It is even more useful, as it will send to stdout a lot of useful messages about the connections managed by the proxy:

78.41.210.130 - - [19/Jul/2010 22:42:08] "CONNECT mail.google.com:443 HTTP/1.1" 200 -
        connect to ocsp.thawte.com:80
78.41.210.130 - - [19/Jul/2010 22:42:08] "POST http://ocsp.thawte.com/ HTTP/1.1" - -

You can even notice when there are connection problems between you and the proxy (even if this is a little bit ugly and should be handled properly through a try...except catch):

----------------------------------------
Exception happened during processing of request from ('78.41.210.130', 49507)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 558, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/SocketServer.py", line 615, in __init__
    self.handle()
  File "./proxy.py", line 20, in handle
    self.__base_handle()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
    method()
  File "./proxy.py", line 46, in do_CONNECT
    self._read_write(soc, 300)
  File "./proxy.py", line 93, in _read_write
    out.send(data)
error: [Errno 32] Broken pipe
----------------------------------------

So, the final solution could be a mix of both approaches. I'll try to do this tonight if we go again to the Walkabout, because I think the problem was that the wifi was causing some kind of trouble with http/https requests. So, what if you use the proxy python script to set up a proxy at home (just like we did before) but instead of setting up the proxy like in the previous example, you do open an SSH connection home, creating a tunnel to forward requests to the proxy?, just like this:

ssh -L 8000:localhost:8000 user@myhost

Then you do not need to modify your /etc/hosts file, you don't need to open port 8000 at home and you do send all the http requests through the ssh tunnel, which in the end is an already established connection (it shouldn't close) while http requests from the browser are going to be multiple requests sent through the wifi link.

Imho, this would be an almost-perfect approach, but I'll try tonight and check if there is any difference.

Posted by wu at 17:20 | Comments (3) | Trackbacks (0)