Skip to content

Latest commit

 

History

History
93 lines (66 loc) · 3.71 KB

README.md

File metadata and controls

93 lines (66 loc) · 3.71 KB

Extensible design patterns for Python

Exploration of extensible design patterns in Python, heavily influenced by Amir Rachum's wonderful "Python Entry Points Explained" article.

Further reading:

Context

It's been 7 glorious years since “Snek Semiconductors and Software, Incorporated” and their subsidiary “Snek Pro Solutions and Consultation Services” cornered the global snek market with an extensible command line tool that brought sneks right into the homes of millions. However, whilst you, as Benevolent Dictator for Life, have been resting on your laurels in the Bahamas, the world has moved on and your new CEO and VP R&D have been begging you for months to come back to the office and help them do the same.

As you arrive at Snek HQ, you see your VP R&D lambasting the company's current set of snek offerings whilst new competitors have adopted distributed systems and microservices for on-demand snek delivery.

"Customers these days don't want to install new sneks, they want to download them from the internet! We should be leading the market in web-based SaaS (Sneks as a Service) solutions, rather than focussing on desktop applications."

Intrigued, you listen in on the conversation as a product owner tries to defend the current strategy:

"But our customers have always installed sneks and accessed them via a command line tool. In this new design, where would they get them from?"

Unpeturbed, the VP R&D provides an instant response:

"A remote snek data store that can be accessed via a HTTP API."

A member of the cyber-security team then wades in with a follow-up question:

"But our customers are very concerned about the privacy of their sneks. They want to be able to share sneks internally without risking IP leakage across the open internet. The current market-leading SaaS solutions don't cater for this level of data security."

The VP R&D needs to think for a short while, but quickly comes up with a solution:

"That's fine, we'll sell them their own SaaS platform that they can deploy internally. Their users will still get the same product, it'll just be managed by their own internal IT group, rather than by us."

Eventually, an unconvinced engineering manager steps forward:

"But our existing customers' IT departments have differing policies over the kind of technologies that they can adopt internally. How can we cater for all this complexity?"

This time the VP R&D looks concerned and takes a while to contemplate in deep thought, before responding:

"Well we might not be able to cater for every scenario, but in that case our customers should be able to contribute their own snek data stores, just as they were able to contribute their own sneks."

You slip away before being pulled into the conversation, both excited by the VP R&D's vision but also weary about the leap into uncharted territory that it may require...

Installation Guide

Requirements: Python 3.10+

Build environment

python -m venv --clear --upgrade-deps .venv

Activate environment

On Unix:

source .venv/bin/activate

On Windows:

.venv/bin/activate.bat

Install package

(.venv) pip install -e .

Run the snek server

In one terminal:

(.venv) uvicorn --factory snek_lib.server.app:create_app

Run the snek client

In another terminal:

(.venv) snek [--type] SNEK_NAME