Saturday 2:55 p.m.–3:15 p.m. in Terrace
Supporting Everything - Python2/3, Mac/Linux/Windows
James Saryerwinnie
- Audience level:
- Intermediate
Description
There comes a time in the life of a library where it must leave your machine and find a home in a far away computer. That computer might even run windows. This talk will show how you can write a library that supports Linux/Mac/Windows and runs on python 2 and 3.
Abstract
This talk will show you how to write libraries that can run on multiple platforms (Linux/Mac/Windows) as well as multiple python versions (python2/3). We'll look at real world examples that show how existing projects handle these compatibility issues, along with specific tips and design techniques you can use to ensure your library runs on as many platforms as possible.
Outline:
- Overview
-
Why support everything?
-
Python differences
- Common 2/3 differences you'll run into
-
Using a single codebase
-
Platform Differences
- Differing libraries per platform (os, subprocess, mmap, etc.)
- Libraries not available on all platforms
- Detecting your platform
-
File Handling on Windows
-
Tips/Design Techniques
- Conditionals
- Classes and factories
- Abstracting at the module level
-
Common gotchas
-
Testing
- CI is your friend (Travis CI/Jenkins)
-
Testing tips
-
Real world projects
- stdlib
- aws-cli/botocore
- semidbm