SlideShare a Scribd company logo
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Software is both
archeology and time-
travel
Copyright 2024 Kudzera,
LLC
Your job is to deliver
value in a timely
manner
Copyright 2024 Kudzera,
LLC
How do you enable the
future to be just as
efficient?
Copyright 2024 Kudzera,
LLC
Extensibility
Copyright 2024 Kudzera,
LLC
0) Think about the humans
Copyright 2024 Kudzera,
LLC
Extensibility Themes
Copyright 2024 Kudzera,
LLC
1) Reduce Commit Complexity
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
2) Be Mindful of OCP
Copyright 2024 Kudzera,
LLC
Open-Closed Principle
Copyright 2024 Kudzera,
LLC
Code should be open to
extension and closed
for modification
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
When To Split
● Are easy things hard to do?
● Do you encounter pushback against similar features?
● Do you have consistently high estimates?
● Do commits contain large changesets?
● Are you mixing policy changes with mechanisms changes
Copyright 2024 Kudzera,
LLC
Policies vs. Mechanisms
Copyright 2024 Kudzera,
LLC
3) Separate Policies and
Mechanisms
Copyright 2024 Kudzera,
LLC
From backoff documentation
Copyright 2024 Kudzera,
LLC
From Flask documentation
Copyright 2024 Kudzera,
LLC
4) Data-Driven Designs
Copyright 2024 Kudzera,
LLC
Data options
● Can you put your data in a collection?
● Configuration Files?
● Persistence Layers (i.e. databases, bucket storage, etc.)?
Copyright 2024 Kudzera,
LLC
5) Develop Libraries First
Copyright 2024 Kudzera,
LLC
Good Library Design
● README-driven
● Tested
● Easily Consumable
● Clearly-stated opinions
● Releasable (w/ Documentation)
● Extensible
● Composable
Copyright 2024 Kudzera,
LLC
Composability
Copyright 2024 Kudzera,
LLC
From Flask documentation
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
6) Create Building Blocks
Copyright 2024 Kudzera,
LLC
Architectural Extensibility
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Dependencies
Copyright 2024 Kudzera,
LLC
Physical Dependencies
Copyright 2024 Kudzera,
LLC
from typing import Callable
@dataclass
class Metadata:
does_match: Callable[[User], bool]
if __name__ == "__main__":
run_self_test()
Copyright 2024 Kudzera,
LLC
pip install requests
Copyright 2024 Kudzera,
LLC
Physical Dependencies
● Hard-coded into source code
● Easy to follow from A to B
● Easily understandable
● Easy to find, hard to change
● Hard to substitute or mock out
● Understandable by static analysis tools
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
pipdeptree
Copyright 2024 Kudzera,
LLC
pydeps
Copyright 2024 Kudzera,
LLC
pyan3
Copyright 2024 Kudzera,
LLC
What Happens If You Need
Something To Change?
Copyright 2024 Kudzera,
LLC
A
B
C
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
A
B
C
Copyright 2024 Kudzera,
LLC
A
B
D
Copyright 2024 Kudzera,
LLC
A
B
Whatever
Copyright 2024 Kudzera,
LLC
Logical Dependencies
Copyright 2024 Kudzera,
LLC
requests.post("table-management/pizza-made", {
"id": order,
"pizza": pizza.to_json()
})
# meal is an abstract type
meal: Meal = meal_factory.create("pizza")
Copyright 2024 Kudzera,
LLC
Logical Dependencies
● Typically determined at run-time
● Readability suffers
● Debuggability suffers
● Hard to find, easy to change
● Easy to substitute or mock out
● Not understandable by static analysis tools
● Crucial for Abstraction
Copyright 2024 Kudzera,
LLC
7) Trade-off Dependencies
Judiciously
Copyright 2024 Kudzera,
LLC
Event-Driven Architectures
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
def complete_order(order: Order):
package_order(order)
notify_customer_that_order_is_done(order)
notify_restaurant_that_order_is_done(order)
Copyright 2024 Kudzera,
LLC
Architectural Extensibility
Copyright 2024 Kudzera,
LLC
Producer
Transport
Consumer
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Producer
Transport
Consumer
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
pypubsub
Copyright 2024 Kudzera,
LLC
from pubsub import pub
def notify_customer_that_meal_is_done(order: Order):
# ... snip ...
pub.subscribe(notify_customer_that_meal_is_done, "meal-done")
Copyright 2024 Kudzera,
LLC
from pubsub import pub
def complete_order(order: Order):
package_order(order)
pub.publish("meal-done", order)
Copyright 2024 Kudzera,
LLC
8) Use Event-Driven
Architectures to Decouple
Producers and Consumers
Copyright 2024 Kudzera,
LLC
Pluggable Architectures
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Plug-in examples
● pytest
● poetry
● hypothesis
● pylint
Copyright 2024 Kudzera,
LLC
Plugging Into Algorithms
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
Copyright 2024 Kudzera,
LLC
@dataclass
class PizzaCreationFunctions:
prepare_ingredients: Callable
add_pre_bake_toppings: Callable
add_post_bake_toppings: Callable
Copyright 2024 Kudzera,
LLC
def create_pizza(
pizza_creation_functions: PizzaCreationFunctions
):
pizza_creation_functions.prepare_ingredients()
roll_out_pizza_base()
pizza_creation_functions.add_pre_bake_toppings()
bake_pizza()
pizza_creation_functions.add_post_bake_toppings()
Copyright 2024 Kudzera,
LLC
pizza_creation_functions = PizzaCreationFunctions(
prepare_ingredients=mix_zaatar,
add_pre_bake_toppings=add_meat_and_halloumi,
add_post_bake_toppings=drizzle_olive_oil
)
create_pizza(pizza_creation_functions)
Copyright 2024 Kudzera,
LLC
pizza_creation_functions = PizzaCreationFunctions(
prepare_ingredients=cook_bulgogi,
add_pre_bake_toppings=add_bulgogi_toppings,
add_post_bake_toppings=garnish_with_scallions_and_sesame
)
create_pizza(pizza_creation_functions)
Copyright 2024 Kudzera,
LLC
Plugging Into Packages
Copyright 2024 Kudzera,
LLC
Stevedore
Copyright 2024 Kudzera,
LLC
from abc import abstractmethod
from typing import runtime_checkable, Protocol
@runtime_checkable
class UltimateKitchenAssistantModule(Protocol):
ingredients: list[Ingredient]
@abstractmethod
def get_recipes() -> list[Recipe]:
raise NotImplementedError
@abstractmethod
def prepare_dish(inventory: dict[Ingredient, Amount],
recipe: Recipe) -> Dish:
raise NotImplementedError
Copyright 2024 Kudzera,
LLC
class PastaModule(UltimateKitchenAssistantModule):
def __init__(self):
self.ingredients = ["Linguine",
# ... snip ...]
def get_recipes(self) -> list[Recipe]:
# ... snip returning all possible recipes ...
def prepare_dish(self, inventory: dict[Ingredient, Amount],
recipe: Recipe) -> Dish:
# interact with Ultimate Kitchen Assistant
Copyright 2024 Kudzera,
LLC
from stevedore import extension
def get_all_recipes() -> list[Recipe]:
mgr = extension.ExtensionManager(
namespace='ultimate_kitchen_assistant.recipe_maker',
invoke_on_load=True,
)
def get_recipes(extension):
return extension.obj.get_recipes()
return list(itertools.chain(mgr.map(get_recipes)))
Copyright 2024 Kudzera,
LLC
from setuptools import setup
setup(
name='ultimate_kitchen_assistant',
version='1.0',
#.... snip ....
entry_points={
'ultimate_kitchen_assistant.recipe_maker':
['pasta_maker =
ultimate_kitchen_assistant.pasta_maker:PastaModule'],
},
)
Copyright 2024 Kudzera,
LLC
9) Use Pluggable Python for
Extension Points
Copyright 2024 Kudzera,
LLC
0) Think about the humans
1) Reduce Commit Complexity
2) Be Mindful of OCP
3) Separate Policies and Mechanisms
4) Consider Data-Driven Design
5) Develop Libraries First
6) Create Building Blocks
7) Trade-off Dependencies Judiciously
8) Use Event-Driven Architectures to Decouple Producers/Consumers
9) Use Pluggable Python for Extension Points
Copyright 2024 Kudzera,
LLC
10) Don't Overextend Yourself
Copyright 2024 Kudzera,
LLC
Who Am I?
Principal Software Engineer
Cloud Software Group
Owner of Kudzera, LLC
Author of Robust Python
Organizer of HSV.py
Extensible Python:
Robustness Through
Addition
Patrick Viafore

More Related Content

Similar to Extensible Python: Robustness through Addition - PyCon 2024 (20)

PDF
Software Mistakes and Tradeoffs 1st Edition Tomasz Lelek
booteampong
 
ODP
Path dependent-development (PyCon India)
ncoghlan_dev
 
PDF
Robust Python Write Clean And Maintainable Code 1st Edition Patrick Viafore
yunyunburm
 
PDF
Interop 2015: Hardly Enough Theory, Barley Enough Code
Jeremy Schulman
 
PDF
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Pôle Systematic Paris-Region
 
PDF
Architecture Patterns with Python 1st Edition Harry Percival
allendanelia
 
PPTX
Robust Python.pptx
Patrick Viafore
 
PDF
Python RESTful webservices with Python: Flask and Django solutions
Solution4Future
 
PDF
Data Science meets Software Development
Alexis Seigneurin
 
PDF
Architecture Patterns with Python 1st Edition Harry Percival
ookuboichika
 
PDF
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
Sergii Khomenko
 
PDF
Software maintenance PyConPL 2016
Cesar Cardenas Desales
 
KEY
Intro To Django
Udi Bauman
 
PPT
Faster! Faster! Accelerate your business with blazing prototypes
OSCON Byrum
 
PPT
Introduction to the intermediate Python - v1.1
Andrei KUCHARAVY
 
PDF
Flask docs
Kunal Sangwan
 
PDF
High Performance Python 2nd Edition Micha Gorelick Ian Ozsvald
hunelibuzhan
 
PDF
Pycon2017 instagram keynote
Lisa Guo
 
PDF
FastAPI - Rest Architecture - in english.pdf
inigraha
 
PDF
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Software Mistakes and Tradeoffs 1st Edition Tomasz Lelek
booteampong
 
Path dependent-development (PyCon India)
ncoghlan_dev
 
Robust Python Write Clean And Maintainable Code 1st Edition Patrick Viafore
yunyunburm
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Jeremy Schulman
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Pôle Systematic Paris-Region
 
Architecture Patterns with Python 1st Edition Harry Percival
allendanelia
 
Robust Python.pptx
Patrick Viafore
 
Python RESTful webservices with Python: Flask and Django solutions
Solution4Future
 
Data Science meets Software Development
Alexis Seigneurin
 
Architecture Patterns with Python 1st Edition Harry Percival
ookuboichika
 
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
Sergii Khomenko
 
Software maintenance PyConPL 2016
Cesar Cardenas Desales
 
Intro To Django
Udi Bauman
 
Faster! Faster! Accelerate your business with blazing prototypes
OSCON Byrum
 
Introduction to the intermediate Python - v1.1
Andrei KUCHARAVY
 
Flask docs
Kunal Sangwan
 
High Performance Python 2nd Edition Micha Gorelick Ian Ozsvald
hunelibuzhan
 
Pycon2017 instagram keynote
Lisa Guo
 
FastAPI - Rest Architecture - in english.pdf
inigraha
 
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 

More from Patrick Viafore (12)

PDF
User-Defined Types.pdf
Patrick Viafore
 
PDF
The Most Misunderstood Line In Zen Of Python.pdf
Patrick Viafore
 
PDF
Tip Top Typing - A Look at Python Typing
Patrick Viafore
 
PPTX
RunC, Docker, RunC
Patrick Viafore
 
PDF
DevSpace 2018 - Practical Computer Science: What You Need To Know Without Th...
Patrick Viafore
 
PPTX
Controlling Raspberry Pis With Your Phone Using Python
Patrick Viafore
 
PDF
C++17 not your father’s c++
Patrick Viafore
 
PPTX
Building a development community within your workplace
Patrick Viafore
 
PPTX
Lambda Expressions in C++
Patrick Viafore
 
PPTX
BDD to the Bone: Using Behave and Selenium to Test-Drive Web Applications
Patrick Viafore
 
PPTX
Hsv.py Lightning Talk - Bottle
Patrick Viafore
 
PPTX
Controlling the browser through python and selenium
Patrick Viafore
 
User-Defined Types.pdf
Patrick Viafore
 
The Most Misunderstood Line In Zen Of Python.pdf
Patrick Viafore
 
Tip Top Typing - A Look at Python Typing
Patrick Viafore
 
RunC, Docker, RunC
Patrick Viafore
 
DevSpace 2018 - Practical Computer Science: What You Need To Know Without Th...
Patrick Viafore
 
Controlling Raspberry Pis With Your Phone Using Python
Patrick Viafore
 
C++17 not your father’s c++
Patrick Viafore
 
Building a development community within your workplace
Patrick Viafore
 
Lambda Expressions in C++
Patrick Viafore
 
BDD to the Bone: Using Behave and Selenium to Test-Drive Web Applications
Patrick Viafore
 
Hsv.py Lightning Talk - Bottle
Patrick Viafore
 
Controlling the browser through python and selenium
Patrick Viafore
 
Ad

Recently uploaded (20)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
July Patch Tuesday
Ivanti
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
July Patch Tuesday
Ivanti
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Ad

Extensible Python: Robustness through Addition - PyCon 2024

Editor's Notes

  • #15: https://www.pexels.com/photo/macro-photography-of-a-pavement-crack-2847615/
  • #27: https://www.pexels.com/photo/boys-playing-with-toys-3939173/
  • #30: https://www.pexels.com/photo/barriers-on-asphalt-road-9826960/