Kris Neuharth

Code and adventure.

Nov 22, 2013

Python ArcGIS Performance Improvement

For a recent project I needed to parse ArcGIS files using Python. I came across this great library called pyshp which is written by someone with far more experience than me with GIS. I wanted to use pyshp to parse postal code data and then I would run that through some post-processing. The performance was less than stellar and I decided to see if there were any possible bottlenecks in the library.

After looking at the well-documented pyshp code I found a few methods that were backed by iterators but strangely enough nothing existed yet to get each shape record with its associated metadata. I cobbled a new method together that did this and humbly submitted this patch. It offers a quick performance win and is an easy addition to this great library.

Hopefully this will get merged in at some point for others to use.

May 24, 2013

Wanna Buy A Watch? Search

I made a fun thing: Wanna Buy A Watch? Search

This project ties together a few of my favorite things: coding and watches. It uses Python and Flask for the web scraper and site backend, Twitter Bootstrap for the UI, IndexDen for hosted search, and Heroku for hosting.

Code can be found here.

Apr 25, 2013

Your Tests Are Lying To You

This is a lightning talk I delivered (shouted?) during PyCon 2013 at the infamous TIP-BOF open space. It covers potential ways your unit tests may be yielding false positives when they should indeed be failing when using the Mock library.

I include some example code to demonstrate how not using autospec is bad and present an example of how to extend the basic Mock and MagicMock classes to add new test assertions to further prevent common testing mistakes.

Code and slides can be found here: Your Tests Are Lying To You

Apr 25, 2013

Pika and RabbitMQ Reconnect Example

For a recent infrastructure project at work we decided to use RabbitMQ as our message broker to queue up e-mail messages to be sent to to our customers. While we ultimately ended up using Celery for managing and processing the tasks, I initially wrote a few custom classes to do this using Pika.

We mainly decided to go with Celery because it was very mature and abstracted things away in a very usable way. While the pure Pika implementation was faster, it did not make sense when Celery offers so much more.

One thing I ran into while using Pika was the lack of a good example in their documentation to cover reconnecting when a connection to the queue is lost.

I threw together a Github repository that correctly demonstrates how to reconnect to RabbitMQ when a connection is lost.

You can find it here.

Feb 15, 2013


Hello world !