Full Stack Type Safety

Beyond PEP-484 – ensure type consistency between layers

Szymon Pyżalski

APIs Django JavaScript Type-Hinting Web Protocols

See in schedule Download/View Slides

The introduction of PEP-484 gave us an option to enforce the internal type consistency of our Python applications. Our web projects, however, consist of multiple layers, with the Python app taking the role of an HTTP backend. What options do we have to ensure consistency across our stack?
In this talk, we will see some technologies that we can employ to enforce the contract between the layers of our stack. Especially between the frontend and backend. We will demo, how this can be achieved with REST/Swagger and with GraphQL. As both the Graphene library and the open API support for django-rest-framework are both a work-in-progress, we would check, what is possible, and what is still lacking. We will also discuss various approaches to the design: backend first, auto-generating backend from the spec, and TDD, with their advantages and disadvantages.
The topic would be discussed on a simple web application. We would try to play some realistic scenarios, where a careless developer breaks the contract to see how such a mistake can be spotted in the CI phase of the development cycle.
Basic knowledge of Django and JavaScript is required to understand the talk. Some familiarity with TypeScript and ReactJS would also be helpful. However, I plan to explain the code to the listeners that didn’t have prior exposure to these technologies.

Type: Talk (30 mins); Python level: Intermediate; Domain level: Beginner

Szymon Pyżalski


Proffesional Python developer for 8 years. Worked for STX Next, Allegro Group. Currently for Egnyte Inc.
Likes: consistency, simplicity, DRY-ness. Dislikes: hacks, boilerplate, spaghetti.