Let's stop repeating our APIs

By Timothy Edmund Crosley

Elevator Pitch

Have you ever created a Python API, only to have to go create a corresponding REST API and CLI tool which must be kept in sync? We don’t accept repetition in code, and we shouldn’t accept it in our APIs. In this talk, I’ll discuss how to accomplish API reuse while maintaining Separation of Concerns.

Description

What makes a good Python API? What makes a good HTTP API? What makes a good command line interface? Does the answer to these 3 questions have more in common or more in contrast? In the past, the development ecosystem and frameworks were unintentionally built in a way that optimized solely for differences, but as time has gone by there’s lot’s of evidence that once you look past protocols, formats, and implementation details, API design is API design, and is applicable to many interfaces with less variation than there is commonality. Additionally, encouraging API reuse across interfaces shows promise for increasing the quality and maintainability of all interfaces.

During this talk, we’ll look at how to cleanly accomplish API reuse within Python, without sacrificing Separation of Concerns. I’ll discuss some of the benefits and disadvantages of this approach, and where it makes sense to integrate it into new and existing code bases. We’ll talk about how to leverage common APIs to produce automatic self-documentation, and finally, I’ll introduce you to the pioneering Python framework that enables API reuse across interfaces: hug.

Outline:

  • 1 Minute: Quick Introduction
  • 4 Minutes: An overview of how APIs and interfaces are currently developed
  • 5 Minutes: An argument for why that approach is insufficient
  • 5 Minutes: Talking about ways to better approach API design and development
  • 5 Minutes: Introducing hug’s approach to API development
  • 4 Minutes: Building an example API using hug
  • 1 Minute: Wrap up