09-16, 16:30–17:00 (Europe/London), Assembly Room
Do you have confidence in your data without painful explicit checks? Use types in your code - attrs is a smart solution to make life easier.
REST microservices commonly use JSON as inputs and outputs. It's a simple and language-agnostic way of communication. The JSON can be easily translated into simple python structures like dictionaries and arrays.
Although it's possible to use raw input data inside your application, type checking in Python increases confidence in our code with fewer unit tests and simpler refactoring.
Translating primitive data to typed data structures can be a tedious job, but with the help of
cattrs modules, it's a simple task which does not add a lot of code.
The talk will present why choosing
attrs can be good for your project and how to use it effectively, using
cattrs to structure simple data into your data objects, show some pitfalls and how we solved them.
My first program was in C64 BASIC, then Assembler, Amos, Pascal, C, C++, Java, Perl - but when I found Python I just stuck with it.
My first job was as a Python/Django developer in 2005.
Likes deleting lines, don't like introducing bugs.