Go to content

Kyle Knapp - It Works on My Machine: Writing Python Code for Any Environment

Kyle Knapp - It Works on My Machine: Writing Python Code for Any Environment [EuroPython 2015] [20 July 2015] [Bilbao, Euskadi, Spain] Have you ever developed a nice, well-working python program on one environment, only to have it blow up with exceptions and tracebacks when you run it on a different environment? Have no fear! This talk will show you how to write and maintain python code that is compatible across environments that may differ by python versions and/or operating systems. Techniques and tips will be drawn from lessons and experiences gained from making the AWS CLI, a python-based command line tool to manage AWS resources, compatible across a wide range of environments. In a case-study-like format, real-life compatibility issues encountered while developing the AWS CLI will be presented along with how we resolved each of them. These real-life examples will encompass, but will not be limited to, the following topics: • How to use functions and classes that may differ across python versions and/or operating systems • How to handle version-specific bugs • How to handle strings, bytes, and Unicode across python versions • How to handle differing locale settings • How to handle file operations across operating systems • How and when to vendor dependencies • How to write tests that are compatible across python versions and operating systems • How to create a testing environment that monitors compatibility of code across various environments Ultimately, the goal of these examples is introduce to you some effective, real-world programming practices to overcome your current or next compatibility issue.

July 20, 2015