#Python

 Clean Architectures in Python

Architectural considerations are often overlooked by developers or completely delegated to a framework. We should start once again discussing how applications are structured, how components are connected and how to lower coupling between different parts of a system, to avoid creating software that cannot easily be maintained or changed. The ""clean architecture"" model predates Robert Martin, who recently brought it back to the attention of the community, and is a way of structuring applications that leverages layers separation and internal APIs to achieve a very tidy, fully-tested, and loosely coupled system. The talk introduces the main ideas of the architecture, showing how the layers can be implemented in Python, following the content of the book ""Clean Architectures in Python"" edited by Leanpub. The book recently reached 25,000 downloads and many readers found it useful to start learning how to test software and how to structure an application without relying entirely on the framework.

Architecture DDD Python Video

Nov 13 2022

 Static Duck Typing in Python with Protocols

Protocols in Python provide a nice way to use duck typing while still having some static type guarantees. You can define contracts for your functions without caring too much about the actual types of your inputs.

Python

Nov 29 2021

 Django structure for scale and longevity

Why? Django is great. But as we add new features, as our dev team grows and the software needs to be stable on production, things can get quite messy. We are going to look at some common patterns, derived from experience, on how to structure your Django project for scale and longevity. What? Main topics are: Django service layer or where should business logic live? Using Django Rest Framework in a clean and repeatable way and combining it with the service layer. Testing everything that matters, without repeating ourselves in different tests. We are going to talk about when to rely on existing abstraction so it's actually helpful and when to avoid existing abstraction, and code things ourselves. The examples showed in this talk are derived from working with Django in the last 5 years on projects with: Daily production usage and production deploys. Dozens of apps. Hundreds of models and APIs. Tens of integrations working simultaneously. Teams of 5 to 10 people. Who? Key takeaways from the talk: Increased productivity when developing with Django. Deeper understanding of the software development process with Django. Demo project with everything mentioned in it. The talk is great for all levels of Django knowledge - from beginners to advanced users and teams. How The main way of getting the point across is going to be by showing regular code, talking how it can get messy and then following up with examples of improving that code. Hopefully this talk will start a lot of discussion afterwards. Breakdown of the talk: Django service layer: Fat models or fat views? Where do I put my business logic? What is a service and what goes into a service? What is a selector and what goes into a selector? General Django structure: How many apps should I have? Structuring your code so youр team can be more productive and have less conflicts. Common modules and utilities. Doing APIs with Django Rest Framework: Splitting APIs in 2 groups - "giving data" and "taking data" Using a lot of generics for "give data" When do to selectors? Using no generics for "take data" (APIView + Services) Handling errors from services Inlining serializers and avoiding serializers reuse A neat inline_serializer util Introducing general error formatting for your API Testing all of that - what should be and not be tested?

Design Django Python Video

Aug 18 2021

 Higher Kinded Types in Python

* What Higher Kinded Types (HKTs) are and why they are useful * How they are implemented and what limitations there are * How can you use them in your own projects

Python

Oct 30 2020

 "What is a Coroutine Anyway?" - John Reese

This talk will start with basic concepts of functions, including how they are represented in memory, how state is tracked, and how function calls interact with the stack. We’ll then cover the common methods of running multiple functions concurrently, as well as the benefits and difficulties of concurrency in Python. We’ll then introduce the concept of coroutines, a variant of functions, and discuss how coroutines manage state and execution differently from functions. We’ll show some high level examples of coroutines that communicate with each other, and look at how they can be of use for I/O bound workloads. Then we’ll finish by showing how coroutines are implemented in Python, what the async/await keywords are actually doing when you use them in your code, and how all of these concepts are leveraged by the AsyncIO framework to build high performance applications in modern, clean Python. AsyncIO uses coroutines to deliver high performance from a single thread. But coroutines can be mysterious. How do they work? Starting from first principles, we’ll take a look at the basic concepts of coroutines and the unique problems they solve, then finish by deconstructing the core pieces of the AsyncIO framework. This talk is for developers of all backgrounds. No CS degree required!

Async Python Video

Jun 12 2020

 Python Standard Library: The Hidden Gems

The Python Standard Library is a very rich toolset, which is the reason why Python is stated to come with ""batteries included"". In such an amount of features and tools it's easy to get lost and miss some of the less unknown modules or gems hidden within the whole load of functions and classes. This talk aims at showcasing some recipes, snippets and usages of standard library modules and functions that are less known or that are not covered in the most common books and tutorials available for Python. The talk will try to showcase a bunch of short examples in the hope to foster the ""oh, wow! I didn't think about that"" reaction at least once in the audience. We will see how frequently for tasks where you used third party libraries or frameworks a solution bultin into the standard library is already available, and such solution is guaranteed to be maintained and well working for the years to come thanks to the standard library reliability and stability.

Python Snippet Video

Jun 8 2020

 Lynn Root - Advanced asyncio: Solving Real-world Production Problems

Everyone’s talking about it. Everyone’s using it. But most likely, they’re doing it wrong, just like we did. By building a simplified chaos monkey service, we will walk through how to create a good foundation for an asyncio-based service, including graceful shutdowns, proper exception handling, and testing asynchronous code. We’ll get into the hairier topics as well, covering topics like working with synchronous code, debugging and profiling, and working with threaded code. We’ll learn how to approach asynchronous and concurrent programming with Python’s `asyncio` library, take away some best practices, and learn what pitfalls to avoid.

Async Python Video

Jun 8 2020