<< ALL BLOG POSTS

Colander Fixes at the Pyramid Development Sprint 2013

Table of Contents

I arrived in Halle on the heels of the Canal Sprint (Plone Security) in Amsterdam. The first day, I read through the coding guidelines and set up my editor to conform with the PEP8 ignores and trailing whitespace rules for the project. After all, this is one of the tenets of PEP8, to quote the Python style guide directly:

A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important.

Focusing on Colander

After making flake8 understand the rules of the project, I looked through issue trackers for Pyramid and the other Pylons projects. I started fixing bugs in Colander, a data validation, and de-serialization library since they seemed like a good starting point. My first task with any of the issues was to write a failing test since Pyramid requires 100% code coverage.

Colander SchemaNode type constructor

The first issue I tackled was a feature request for the initialization of a SchemaNode that allows the typ to be assigned via a keyword argument. This can be nice if you need to dynamically create a schema and build up the type of the node conditionally. Until now, the first argument to the constructor has been required to be the typ of the node.

Colander API inconsistencies

Next up I started looking into an issue where the API of Colander was not consistent. There were some places where msg was being passed into an __init__ and others where message was being passed in. When I started to look into the issue, I realized that someone had already fixed it. The problem was that the change would have broken the API. I went through and changed the code to handle the two arguments and issue a deprecation warning if message was passed in. This led into a strange case in the tests where the warnings.catch_warnings context manager would not run for one of the tests. I ended up re-factoring this to just monkey patch the warn method of the warnings module. This made the tests pass and cleaned up some spurious output when the test suite ran.

I'm back on IRC

At some point, I was helping plamut get started on Colander tasks and he tried to private message me on IRC. My IRC client has been broken for a while and as usual, I did not receive the message. I spent a good chunk of time fixing this since I've had a lot of people try and get a hold of me. With the #irssi channel's help and plamut's testing, we finally got it working again!

The last day

On the last day of the sprint, we started by cranking up Rage Against the Machine's self-titled debut album. It was a fun start to the day while we sang, played the air guitar and headbanged our way into the day. And maybe that is what later led to a mostly civilized discussion about trailing whitespace and PEP8 that mcdonc kept trying to end.

Colander translations

I started Saturday by tackling an issue with the translation setup. The message catalog was out of date and the compiled files were also. I cleaned up what I could in the fuzzy matching and left the remaining items behind. Then I re-compiled the catalog and sent in my pull request. Still, need help from translators in several languages to fix up the remaining translation changes.

Colander.deferred

The last issue I tackled was making sure the deferred decorator retained the information from the decorated function. This ticket was over two years old! By default, when a decorator is applied, the decorated function then has the doc string, name, etc. of the decorator and not the original. This could be confusing when inspecting an object or running a sphinx autodoc on your code. Now the decorator uses the functools.update_wrapper from the standard library to ensure the original attributes of the function are preserved.

The sprint was great

Overall, the sprint was quite productive for me. The gocept office was a great place to sprint. They catered to our every need and made sure everyone was comfortable. We sprinted outside in their garden every day. It was awesome to be hanging outside in the shade and hacking on software!

More details about what the rest of the sprinters accomplished on the sprint wrap up page on the Pyramid wiki.  Also, Calvin wrote a post on the Pyramid Deform fixes he worked on.

Want to learn more about Pyramid?

Related Posts
How can we assist you?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.