Ugggg, zombie day today as I attempt to get work done after a crazy PyOhio this year. Just like the last two this was a great regional conference I'm so glad that people put on. So congrats to the team for a 3rd year and some great stuff. The nice thing this year is that I managed to finally reach a goal of mine to get a job doing Python. After being a wanna-be the last two years, I got a chance to give back a bit more than I took for the first time. So below is a brain dump of my view of the conference. I want to thank all the awesome people that came to the open spaces, provided great insight, and to the speakers I attended for showing me cool stuff I've yet to see. If you've got any questions or corrections from my dump please let me know. And if you were the one giving the talk, or want to add let me know and I'll toss an link/edit in here going forward.
The full schedule is up at: http://www.pyohio.org/2010/Schedule
Python Koans - Tutorial
I started out with the Koans tutorial track. You can get the koans from: http://bitbucket.org/mcrute/python_koans/src/tip/python%202_6/
The idea is that you get the source code which is setup as a series of unit tests. Each test is broken and you need to fix it in order to understand some aspect of Python. They've got a ton of work in here and it's a really fun way to learn about Python.
For instance there's a whole test file for tuples. You have to go in and correct the unit tests so they pass and as you correct them you learn how tuples work and some of the ways you can use them.
You can see all the koans in their directory: http://bitbucket.org/mcrute/python_koans/src/tip/python%202_6/koans/
So one example:
[sourcecode lang="python"] def test_tuples_are_immutable_so_item_assignment_is_not_possible(self): count_of_three = (1, 2, 5) try: count_of_three = "three" except TypeError as ex: self.assertMatch(__, ex) [/sourcecode]
Here it's demonstrating that tuples are immutable. You'll get an exception if you try to edit the tuple in place like this. Your job is to replace the '__' with the name of the exception you'll end up getting.
The koans are small and you can easily test these in a python terminal to help you figure things out. Lots of fun.
Log Analysis with Python
This turned out to not be what I was looking for. It seemed like a chance for the writer of this petit tool to show off his tool. I was hoping for more about how to analyze, generate trends, etc from log files. More on the math/methods. His library seems cool and all, but unless a lot of regular time going over log files I'm not sure how handy it would be.
Open Space - Message Queues
Wrangling the bits, standardizing how apps get built - My Talk
On a side note, all hail the awesome subway lady that got serving us all. I think we might have been some 25 people strong showing up at once and hammered here running the store all on her own. She didn't complain once and was just pure awesome.
Vim open space
The talks were so-so and I decided to instead lead an open space on vim and using it for python work. There were a bunch of people in there and it went over really well. Everyone learned a few new tricks in there. One thing I've updated is to use the plugin pylint.vim so that I can get in-line syntax error checking.
Some of the plugins brought up:
And another link to my vim config: http://github.com/mitechie/pyvim
Controlling Unix Processes with Supervisord
This was a pretty good talk. There were several things I didn't realize that supervisor could do such as writing your own custom event handlers. For instance they have a custom thing that checks for some message that causes them to spin up more web servers to handle an increased server load.
Some of the tricks like tying all your services together under supervisor was pretty neat. For instance they tie in their mysql servers, web app servers, solr full text servers into one supervisor control setup. So they all startup/work together.
Some of the things they do are because they can provide a user control interface for clients. They create something like a cPanel-like interface for users on their network which allows them to restart/stop servers at will.
Code with Style
This talk basically a walk through Pep8. I try hard to keep to Pep8 and use a vim plugin to check my files as I work on them. The two places I have a hard time with it is the line length when you have long single line messages and with complicated list comprehensions.
He demonstrated a couple of tricks:
- for list comprehensions that are complicated you can turn it into a function that you then run across your list/etc via the filter() function.
- for long strings you can avoid the \ at the end of line by using ()
[sourcecode lang="python"] s = ("my one long" " line of text" " is this thing here") [/sourcecode]
will come out as: "my one long line of text is this thing here"
So now I have some work to do to clean up some things I've left behind.
Fabric - Open Space
I wasn't into the next set of talks so I again hosted an open space on fabric. This one got interesting as many people in the room handle large server farms of hundreds of machines and have very separate ops/dev people. So a developer is separated from some of the things I was showing in fabric like stopping/restarting celery, resetting the web app, etc. There was also some question as to the advantage of using something like Fabric over just bash/shell scripts.
So it was interesting to see where fabric fits in, where it falls short, and while it's cool in some aspects, there are a number of limitations and concerns in several use cases.
The one regret was that with the discussion going on we never got other people up front showing off their fabric setups which I would have liked to see. I guess we had a hard time keeping the discussion going in line and I'd have liked to see more stuff from other fabric fans.
Making it go faster
This was the last talk I went to. It started out looking at how to profile your code using cProfile and pstats. I had messed with this, but then he covered using runsnakerun in order to do the profiling which gives you pretty graphs that represent the time spend in functions as a series of shells like this:
You can see the site there:
So it's a decent wrapper around pstats for some more visual/easy to view performance stats. I'll have to try that out in the future.