Skip to main content

A modern Python library of reusable software design patterns.

Project description

pattern_kit

PyPI - Version No dependencies CI Documentation PyPI - Downloads

A modern Python library of reusable software design patterns.
Your blueprint for better Python architecture.


pattern_kit is a developer-friendly Python library offering clean, idiomatic implementations of common software design patterns. It focuses on real-world usability, pragmatic APIs, and simple integration into your projects.

While many examples exist online, pattern_kit is designed as a pip-installable, production-grade package with a consistent structure and proper documentation - making design patterns approachable and usable in everyday codebases.


Features

  • Clean, idiomatic Python implementations
  • Supports both synchronous and asynchronous designs
  • Type-annotated and easy to extend
  • Ready-to-use patterns for real-world projects
  • Extensive documentation with examples
  • Zero dependencies - pure Python, clean and portable

Installation

pip install pattern_kit

Documentation

Full usage examples and pattern guides are available in the official documentation

Quick Examples

Singleton example (using decorator)

from pattern_kit import singleton

@singleton
class Config:
    def __init__(self, env="dev"):
        self.env = env

cfg = Config(env="prod")
print(cfg.env)  # "prod"

same = Config()
assert same is cfg

Event (multicast) example

from pattern_kit import Event

def listener(msg):
    print(f"[sync] {msg}")

async def async_listener(msg):
    print(f"[async] {msg}")

on_message = Event()
on_message += listener
on_message += async_listener

on_message("hello!")         # fire-and-forget
await on_message.call_async("world")  # fully awaited

Who is this for?

Python developers who want to structure their codebase better and apply solid, proven software architecture principles.

Contributing

Contributions are welcome! Feel free to open issues, suggest improvements, or submit pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pattern_kit-1.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

pattern_kit-1.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pattern_kit-1.2.0.tar.gz.

File metadata

  • Download URL: pattern_kit-1.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pattern_kit-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8b1d2197844d6ac5b562319e76032ce18bc2d70dad8e8e5ffa600c36da527e5d
MD5 bf43472b2cd62fd3d2b628b55a2e9a4f
BLAKE2b-256 d21a35cabf32e4f8e7090b04d121704c63deeaeeb657dc08db19ee41e5890390

See more details on using hashes here.

File details

Details for the file pattern_kit-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pattern_kit-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pattern_kit-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52328340b480e9b57c0d196d94bc7b8760488671b5927585c06404a615002b6f
MD5 ef1ce11fb1f18581d24137d28146195d
BLAKE2b-256 a49a07ece77537f942f3596d1d7d130e56c30582c17659479cb6e3517d592cfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page